Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string script = @"
- $Username = 'admin'
- $Password = '1'
- $SecurePass = ConvertTo-SecureString -AsPlainText $Password -Force
- $Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$SecurePass
- Invoke-Command {Get-Process} -ComputerName 0.0.0.0 -Credential $cred
- ";
- ps.AddScript(script);
- var results = ps.Invoke();
- string script = @"
- $username = 'admin'
- $pass = Get-Content C:pass.txt
- $pass1 = ConvertTo-SecureString -AsPlainText $pass -Force
- $cred = New-Object System.Management.Automation.PSCredential -ArgumentList $username,$pass1
- Invoke-Command {get-process} -ComputerName 0.0.0.0 -Credential $cred
- ";
- ps.AddScript("C:\pass.txt").Invoke();
Add Comment
Please, Sign In to add comment