Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $strScriptUser = "<DomainAdmin>"
- $strPass = "<pass>"
- $PSS = ConvertTo-SecureString $strPass -AsPlainText -Force
- $cred = new-object system.management.automation.PSCredential $strScriptUser,$PSS
- $Now = Get-Date -Format g
- $title = 'Restarting T1 Service'
- $msg = 'Please enter reason for restarting T1'
- $text = [Microsoft.VisualBasic.Interaction]::InputBox($msg, $title)
- $Log = $env:username + ", " + $env:computername + ", " + $Now + ", " + $text
- Invoke-Command -ComputerName "SYDSRV02" -scriptblock {
- shutdown /r /t 1
- } -Credential $cred
- Add-Content -Path \\Server\Path\Report.txt $Log
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement