Advertisement
Guest User

Untitled

a guest
Jan 8th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. $username = 'WIN-SERVER-2016customuser'
  2. $password = "custompassword"
  3. $secstr = New-Object -TypeName System.Security.SecureString
  4. $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
  5. $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
  6.  
  7. $Script_block = {cmd /c node index.js}
  8.  
  9. Invoke-Command -ComputerName WIN-SERVER-2016 -Credential $cred -ScriptBlock $Script_block
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement