Last post May 06, 2010 01:53 AM by elad2109
Apr 22, 2010 12:29 PM|elad2109|LINK
I have used the following article to create N local users:
How do I set some batch file ,that I have wrote ,to be executed right when each user logs-in?
(Include it in the statup functions to be executed).
Apr 22, 2010 01:31 PM|siva_sm|LINK
userDirectoryEntry.Properties["scriptPath"].Insert (0, "logonScript.vbs");
Apr 28, 2010 11:48 AM|elad2109|LINK
that was sound promissing.
However I got the exception:
"The directory property cannot be found in the cache.\r\n" .
maybe local users don't have this property in thier "userDirectory" ?
or have you got other idea for that exception ?
May 01, 2010 03:58 PM|siva_sm|LINK
Try homeDirectory instead of userDirectory. Not sure if this is what you are looking for but if you are using the WinNT provider then this gives the user's home folder on the local box.
May 05, 2010 06:34 PM|elad2109|LINK
the batch I wrote only writes an eventlog with message: SessionID = %SessionName%.
I want to run the script only for users which aren't connected to the domain.
I don't want to restart the machine to run the script. (So I cannot just put the script in the "start folder".
I have some problems:
0. Is there a way to set that via c# code?
1. How do I assign this script to be every user logon script? I read many ways to do so but none worked for me (premission mainly).
2. Sometimes when I run the batch file locally and manually - the "SessionName" variable doesn't appear in the environment variables. but only sometimes. What could be the reason ?
3. Now I run rdp.exe via c# to open new sessions. I have also tried to run Psexec with -i flag (attached to a specific session) but SessionName was missing again... Any ideas?
4. Another solution I have thought of:
execute it remotely using Psexec --> cmd --->batch file (withut the cmd "in the middle" the SessionName doesn't appear).
so I have tried
c:\PsTools\psexec.exe \\<Server> -u test2 -p <Password> -i 2 cmd "c:\Users\test-2\Desktop\a"
c:\PsTools\psexec.exe \\<server> -u test2 -p <Password> -i 2 "cmd \"c:\Users\test-2\Desktop\a\""
all of these just open a terminal on the remote machine but don't execute the batch.
May 06, 2010 01:53 AM|elad2109|LINK
DirectoryEntrygroup = localMachine.Children.Find("administrators",
returns the same exception...