public void TestInvokeCommand() { string FileName = Path.GetTempFileName(); bool result = PowerShellRemoting.InvokeCommand("localhost", $@"'test' | Out-File '{FileName}'"); Assert.IsTrue(result); System.Threading.Thread.Sleep(2000); string text = File.ReadAllText(FileName); Assert.AreEqual("test", text); File.Delete(FileName); }
public void TestInvokeCommandWCredentials() { var result = PowerShellRemoting.InvokeCommand("dc1", "whoami; hostname", "DEV", "rasta", "Passw0rd!"); Assert.IsTrue(!string.IsNullOrEmpty(result)); }
public void TestInvokeCommand() { var result = PowerShellRemoting.InvokeCommand("dc1", "whoami; hostname"); Assert.IsTrue(!string.IsNullOrEmpty(result)); }