-= MD =- Posted November 2, 2004 Posted November 2, 2004 Is it possible to make a logon sript when I use remote desktop.And if it is possible, how do I do it
brian873 Posted November 3, 2004 Posted November 3, 2004 I dont think that it is possible. What are you trying to do ?You could use a batch command or VBS script. Eiither to run when yyou logon or double click it. As when you connect to a RD that is already running it will have already loaded up all the system/user settings.hail hail
-= MD =- Posted November 3, 2004 Author Posted November 3, 2004 What are you trying to do ?I want to start and kill some programs when I use Remote desktop. I already have the batch script, but I want to run it when I logon with Remote Desktop
brian873 Posted November 3, 2004 Posted November 3, 2004 ::MDSorry, I do not know of an automated way to do this.hail hail
Phurious Posted November 5, 2004 Posted November 5, 2004 Not to ask a stupid question, but have you tried copying the script to the startup folder under your profile on the remote machine?
-= MD =- Posted November 5, 2004 Author Posted November 5, 2004 Not to ask a stupid question, but have you tried copying the script to the startup folder under your profile on the remote machine?I can do that, but then it will always run (not only with RD)
Phurious Posted November 5, 2004 Posted November 5, 2004 All profiles should have their own independent "Startup" folder, as well as a shared one under the "All Users" profile. As long as no one else is using you username/password, and you copy the script to "C:\Documents and Settings\<YOUR USERNAME>\Start Menu\Programs\Startup" you should be the only one that runs the script after login.
Phyridean Posted November 5, 2004 Posted November 5, 2004 What he means is he wants a script that runs if he logs in with remote desktop, but which does not run if he logs on locally. You might try (assuming you have XP) expanding the options in the connection dialog, and there's a program tab where you could put your batch/VBS file.
Noise Posted November 5, 2004 Posted November 5, 2004 What you need is a utility that you can call from the batch file that can tell if your remote or not and pass a errorlevel.Like a hypothetical program called chkrmt.exe - i.e:echo ... welcome to my PCecho ... determining statuschkrmt.exeif errorlevel=1 goto REMOTEecho ... welcome local user<bunch of stuff here>goto :EOF :REMOTEecho ... wecome remote user<bunch of stuff here>goto :EOF
ixion Posted November 5, 2004 Posted November 5, 2004 start - run - mstsc - options - programsalternatively...enter in your host etc and then save the connection. Then create a batch file that remotely kills the processes, something like pskill would do the job (www.sysinternals.com) and then launch the RDC connection
Noise Posted November 5, 2004 Posted November 5, 2004 Or make it really simple and configure options/programs in the client to run a command.bet you didn't check it did you
KBakker Posted November 6, 2004 Posted November 6, 2004 @-= MD =-Of course is this possible. First of all create a new remote user and activate logon script.Place this *.vbs script in the following directory %WinDir%\System32\Repl\Import\Scripts.In the following code (I use this) you can see that I start/stop services, load programs, make mappings, change proxy settings, change host file settings and redirect data directory to a different drive. '****************************************************************************************' NAME : Logon.Vbs' AUTHOR : Robert Collewijn' DATE : 29-3-2001'' COMMENT : This Script is for making network and printer connections.' Place this script in the following directory. ' %WinDir%\System32\Repl\Import\Scripts''****************************************************************************************Option Explicit ' On Error Resume Next'*** Define Script title ****************************************************************Dim sVersion, sTitleLng, sTitleSht, vFileName, vPositie, vNamesVersion = " v1.5" ' Define VersionsTitleLng = "R.Collewijn - Hardware Diagnostic" ' Define Long titlesTitleSht = "Hardware Diagnostic" ' Define Short titlevFileName = Wscript.ScriptName ' Script Name difinerenvPositie = InStrRev(vName, ".") If vPositie > 0 Then vFileName = Left (vFileName, sPositie -1)'*** Define Object variable *************************************************************Dim sUserDrivesUserDrive = "E:" ' Define default user drive'*** Define Object variable *************************************************************Dim wnw, wsh, fso Set wnw = WScript.CreateObject("WScript.Network")Set wsh = WScript.CreateObject("WScript.Shell")Set fso = CreateObject("Scripting.FileSystemObject")'*** Remove Network Connections ********************************************************* Dim cDrive, sDrive, vDrv For cDrive = 26 To 5 Step -1 sDrive = Chr(cDrive + 64) & ":" If fso.DriveExists(sDrive) Then Set vDrv = fso.GetDrive(sDrive) If vDrv.drivetype = 3 Then ' If it is a network drive wnw.RemoveNetworkDrive sDrive ' Remove mapping End If End If Set vDrv = Nothing Next'*** Create network connection ********************************************************** Dim sUser, sCUser, sUserDir sUser = wnw.UserName ' Curent usernaam sCUser = UCase(sUser) ' Curent username in uppercase sUserDir = sUserDrive & "\Documents and Settings\" & sUserDir & "\" '--- Restore shell folders -------------------------------------------------- Dim sSFRoot, sUSFRoot, aFRoot, oItem sSFRoot = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\" sUSFRoot = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\" aFRoot = Array(sSFRoot, sUSFRoot) For Each oItem In aFRoot wsh.RegWrite oItem & "Cookies", sUserDir & "Cookies" wsh.RegWrite oItem & "Desktop", sUserDir & "Desktop" wsh.RegWrite oItem & "Favorites", sUserDir & "Favorites" wsh.RegWrite oItem & "History", sUserDir & "Local Settings\History" wsh.RegWrite oItem & "Local AppData", sUserDir & "Local Settings\Application Data" wsh.RegWrite oItem & "Local Settings", sUserDir & "Local Settings" wsh.RegWrite oItem & "My Music", sUserDir & "My Documents\My Music" wsh.RegWrite oItem & "My Pictures", sUserDir & "My Documents\My Pictures" wsh.RegWrite oItem & "My Video", sUserDir & "My Documents\My Video" wsh.RegWrite oItem & "Personal", sUserDir & "My Documents" wsh.RegWrite oItem & "Templates", sUserDir & "Templates" Next '--- Restore settings for remote network ------------------------------------ If (sCUser = "XXXXXX" Or sCUser = "XXXXXXX") Then wnw.MapNetworkDrive "F:", "\\DESKTOP\SHARE_1$", , sUser wnw.MapNetworkDrive "G:", "\\DESKTOP\SHARE_2$", , sUser wnw.MapNetworkDrive "H:", "\\DESKTOP\SHARE_3$", , sUser 'enz... End IF '--- disable proxy settings ------------------------------------------------- wsh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 0 ,"REG_DWORD" wsh.RegWrite "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page", "about:blank" '--- Change hosts file ------------------------------------------------------ Dim sCurrentDate, sHostsFile sCurrentDate = Date sCurrentDate = FormatDateTime(sCurrentDate,1) Set sHostsFile = fso.CreateTextFile("c:\windows\system32\drivers\etc\hosts", True) sHostsFile.WriteLine "# This HOSTS file is automatic generated on " & sCurrentDate sHostsFile.WriteLine "# by Network Connection scripting tool written by Robert Collewijn." sHostsFile.WriteBlankLines 2 sHostsFile.WriteLine "127.0.0.1 localhost" sHostsFile.WriteBlankLines 1 sHostsFile.WriteLine "xxx.xxx.xxx.xxx Example # Desktop Example" sHostsFile.Close Set sHostsFile = Nothing '--- Start/stop program's --------------------------------------------------- wsh.Run "C:\Windows\Logi_mwx.exe", 2, False wsh.Run "C:\Progra~1\DiskCl~1\dclean.exe -q", 2, False wsh.Run "C:\Progra~1\Networ~1\VirusS~1\shstat.exe", 2, False wsh.Run "C:\Progra~1\Networ~1\Common~1\Update~1.exe /StartedFromRunKey", 2, False wsh.Run "Net stop services", 2, False'*** End ********************************************************************************
brian873 Posted November 10, 2004 Posted November 10, 2004 Just looking a Group Policy for another reason and came across this. Dont know if it is what you want but a handy find.To run RD with a cerrtain app only. As in the original TS do this.START / RUN / GPEDIT.MSCUSER CONFIGURATION / ADMINISTRATIVE TEMPLATES / WINDOWS COMPNENTS / TERMINAL SERVICES / START A PROGRAM ON CONECTIOIN.This would let you only run MS Word for example.hail hail
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now