public void TestLocalPersistUserPassword() { NTHost host = NTHost.CurrentMachine; string value = "AbCn1122CeF123"; // find a unique user name string userName = GenerateUserName(host); NTLocalUser user = host.CreateLocalUser(userName, "P4ssw0rd123"); user.Password = value; user.Update(); user.Delete(); }
public void TestLocalUserUpdateLastLogon() { NTHost host = NTHost.CurrentMachine; DateTime value = DateTime.MinValue; // find a unique user name string userName = GenerateUserName(host); NTLocalUser user = host.CreateLocalUser(userName, "P4ssw0rd123"); try { user.Update(); user = GetObjectByName(host.GetLocalUsers(), userName); Assert.AreEqual(value, user.LastLogon); } finally { user.Delete(); } }
public void TestLocalGetUserUnitsPerWeek() { NTHost host = NTHost.CurrentMachine; uint value = 5; // find a unique user name string userName = GenerateUserName(host); NTLocalUser user = host.CreateLocalUser(userName, "P4ssw0rd123"); try { user.UnitsPerWeek = value; user.Update(); user = GetObjectByName(host.GetLocalUsers(), userName); Assert.AreEqual(user.UnitsPerWeek, value); } finally { user.Delete(); } }
public void TestLocalUserUpdateScriptPath() { NTHost host = NTHost.CurrentMachine; string value = Process.GetCurrentProcess().StartInfo.FileName; // find a unique user name string userName = GenerateUserName(host); NTLocalUser user = host.CreateLocalUser(userName, "P4ssw0rd123"); try { user.ScriptPath = value; user.Update(); user = GetObjectByName(host.GetLocalUsers(), userName); Assert.AreEqual(user.ScriptPath, value); } finally { user.Delete(); } }
public void TestLocalUserUpdateLogonHours() { NTHost host = NTHost.CurrentMachine; byte[] value = new byte[21] { 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1 }; // find a unique user name string userName = GenerateUserName(host); NTLocalUser user = host.CreateLocalUser(userName, "P4ssw0rd123"); user.LogonHours = value; user.Update(); user = GetObjectByName(host.GetLocalUsers(), userName); CollectionAssert.AreEqual(user.LogonHours, value); user.Delete(); }
public void TestLocalUserUpdateHomeDirectory() { NTHost host = NTHost.CurrentMachine; string value = "c:\\"; // find a unique user name string userName = GenerateUserName(host); NTLocalUser user = host.CreateLocalUser(userName, "P4ssw0rd123"); try { user.HomeDirectory = value; user.Update(); user = GetObjectByName(host.GetLocalUsers(), userName); Assert.AreEqual(user.HomeDirectory, value); } finally { user.Delete(); } }
public void TestLocalUserGetWorkstations() { NTHost host = NTHost.CurrentMachine; string[] value = new string[] { "W1", "w2" }; // find a unique user name string userName = GenerateUserName(host); NTLocalUser user = host.CreateLocalUser(userName, "P4ssw0rd123"); try { user.Workstations = value; user.Update(); user = GetObjectByName(host.GetLocalUsers(), userName); CollectionAssert.AreEqual(user.Workstations, value); } finally { user.Delete(); } }
public void TestLocalUserUpdateMaxStorage() { NTHost host = NTHost.CurrentMachine; uint value = 1000; // find a unique user name string userName = GenerateUserName(host); NTLocalUser user = host.CreateLocalUser(userName, "P4ssw0rd123"); try { // user.Flags |= UserFlags. user.MaxStorage = value; user.Update(); user = GetObjectByName(host.GetLocalUsers(), userName); Assert.AreEqual(value, user.MaxStorage); } finally { user.Delete(); } }