Guest User

Untitled

a guest
Jun 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. string script = @"
  2. $Username = 'admin'
  3. $Password = '1'
  4. $SecurePass = ConvertTo-SecureString -AsPlainText $Password -Force
  5. $Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$SecurePass
  6. Invoke-Command {Get-Process} -ComputerName 0.0.0.0 -Credential $cred
  7. ";
  8.  
  9. ps.AddScript(script);
  10. var results = ps.Invoke();
  11.  
  12. string script = @"
  13. $username = 'admin'
  14. $pass = Get-Content C:pass.txt
  15. $pass1 = ConvertTo-SecureString -AsPlainText $pass -Force
  16. $cred = New-Object System.Management.Automation.PSCredential -ArgumentList $username,$pass1
  17. Invoke-Command {get-process} -ComputerName 0.0.0.0 -Credential $cred
  18. ";
  19.  
  20. ps.AddScript("C:\pass.txt").Invoke();
Add Comment
Please, Sign In to add comment