Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $username = 'WIN-SERVER-2016customuser'
- $password = "custompassword"
- $secstr = New-Object -TypeName System.Security.SecureString
- $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
- $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
- $Script_block = {cmd /c node index.js}
- Invoke-Command -ComputerName WIN-SERVER-2016 -Credential $cred -ScriptBlock $Script_block
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement