michaelwilliams Posted February 28, 2007 Share Posted February 28, 2007 I am working on a script that will prompt the user for a computer name, then turn on RDP on the specified machine. This works fine if I run it locally, specifying my own computer name. However, I can't make it change the registry value on other test machines. I have file and print sharing turned on, so I know that's not an issue. Any advice? ps: I'm guessing the RunAsSet won't be necessary, because it will probably be domain admins running this anyway. Below is the script that I'm using... RunAsSet("userwhat", "what.local", "password") $text = InputBox("RDP Enable", "Type in the computer name you wish to enable RDP") RegWrite("\\"& $text &"\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server", "fDenyTSConnections", "REG_DWORD", 0) Any input would be greatly appreciated. Thanks, mw Link to comment Share on other sites More sharing options...
Danny35d Posted February 28, 2007 Share Posted February 28, 2007 I will advise you to read the remarks in the help file RunAsSet ( ["user", "domain", "password" [, options]] )RunAsSet only work with Run() and RunWait() functionsYou may be able to use command line REG.EXE together with Run() function instead of RegWrite(). AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
herewasplato Posted March 1, 2007 Share Posted March 1, 2007 @michaelwilliams, Welcome to the AutoIt forum. Danny has already mentioned the issue about the RunAsSet and has offered one of several ways to work around that... but you mentioned that you might not even need that line - so, let's leave that issue aside for now and work on your RegWrite line of code. Try this script and see if the "@error" info helps you find your problem:$text = InputBox("RDP Enable", _ "Type in the computer name you wish to enable RDP") RegWrite("\\" & $text & _ "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server", _ "fDenyTSConnections", "REG_DWORD", 0) MsgBox(0, "@error", @error) ;~ 0 if no errors.... I think ;~ 1 if unable to open requested key ;~ 2 if unable to open requested main key ;~ 3 if unable to remote connect to the registry ;~ -1 if unable to open requested value ;~ -2 if value type not supported [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
ptrex Posted March 1, 2007 Share Posted March 1, 2007 @michaelwilliams Maybe this is something that can you get started #include <GUIConstants.au3> $Computer = InputBox("RDP Enable", "Type in the computer name you wish to enable RDP") $oRDP = ObjCreate("MsTscAx.MsTscAx") GUICreate("Embedded RDP control Test", 640, 480, -1 , -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $GUIActiveX = GUICtrlCreateObj($oRDP, 10, 10, 620, 460) GUICtrlSetStyle ( $GUIActiveX, $WS_VISIBLE ) GUICtrlSetResizing ($GUIActiveX,$GUI_DOCKAUTO) GUISetState() $oRDP.Server = $Computer $oRDP.Domain = "Mydom" $oRDP.UserName = "administrator" $oRDP.AdvancedSettings2.ClearTextPassword = "HH90" $oRDP.FullScreen = false $oRDP.AdvancedSettings2.RedirectDrives = False $oRDP.AdvancedSettings2.RedirectPrinters = False $oRDP.AdvancedSettings2.RedirectPorts = False $oRDP.AdvancedSettings2.RedirectSmartCards = False $oRDP.StartConnected = True $oRDP.Connect() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd $oRDP.Disconnect GUIDelete() Exit Enjoy!! ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now