assign a logon script to a local user
Hello, I wrote a c# code that creates new local user DirectoryEntry localMachine = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer"); DirectoryEntry group = localMachine.Children.Find("administrators", "group"); DirectoryEntry user = localMachine.Children.Find(accountName, "user"); Console.WriteLine(user.Properties.ToString()); I tried to set the logon script for that user by doing: localMachine.Properties["scriptPath"].Insert(0, "logonScript.vbs"); localMachine.CommitChanges(); same with group or user instances.but the property doesn't exist in any of theses instances (localMachine, group or user). I know that because I did: System.Collections.ICollection col = localMachine.Properties.PropertyNames; foreach (Object ob in col) { Console.WriteLine(ob.ToString()); } Any idea of how to do that in other way?
May 6th, 2010 9:48am

Hi, You can refer to the following articles: How to Assign a Logon Script to a Profile for a Local User http://support.microsoft.com/kb/315245 How To Assign a Logon Script to a Profile for a Local User in Windows Server 2003 http://support.microsoft.com/kb/324803 Regards, Wilson Jia This posting is provided "AS IS" with no warranties, and confers no rights. Please click "Mark as Answer" when you get the correct reply to your question.
Free Windows Admin Tool Kit Click here and download it now
May 12th, 2010 9:27am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics