Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $strScriptUser = "<Domain>.local\<Account>"
- $strPass = "<Password>"
- $PSS = ConvertTo-SecureString $strPass -AsPlainText -Force
- $cred = new-object system.management.automation.PSCredential $strScriptUser,$PSS
- $Now = Get-Date -Format g
- $title = 'ADD TITLE FOR POPUP'
- $msg = 'ADD MESSAGE FOR POPUP'
- $text = [Microsoft.VisualBasic.Interaction]::InputBox($msg, $title)
- $Log = $env:username + ", " + $env:computername + ", " + $Now + ", " + $text
- Invoke-Command -ComputerName "SYDSRV02" -scriptblock {
- Stop-Service -name "Test Service"
- Start-Sleep -s 25
- Start-Service -name "Test Service"
- } -Credential $cred
- Add-Content -Path \\<Server>\Path\Textfile.txt $Log
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement