Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. $strScriptUser = "<Domain>.local\<Account>"
  2. $strPass = "<Password>"
  3. $PSS = ConvertTo-SecureString $strPass -AsPlainText -Force
  4. $cred = new-object system.management.automation.PSCredential $strScriptUser,$PSS
  5. $Now = Get-Date -Format g
  6. $title = 'ADD TITLE FOR POPUP'
  7. $msg = 'ADD MESSAGE FOR POPUP'
  8. $text = [Microsoft.VisualBasic.Interaction]::InputBox($msg, $title)
  9. $Log = $env:username + ", " + $env:computername + ", " + $Now + ", " + $text
  10.  
  11. Invoke-Command -ComputerName "SYDSRV02" -scriptblock {
  12. Stop-Service -name "Test Service"
  13. Start-Sleep -s 25
  14. Start-Service -name "Test Service"
  15. } -Credential $cred
  16. Add-Content -Path \\<Server>\Path\Textfile.txt $Log
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement