Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $autoscout = Test-Connection -ComputerName autoscout -Quiet
  2. $checkdrives = Test-Path -Path F:\Anime
  3. $username = "afy.server@gmail.com"
  4. $passwordfile = "C:\HTPC\afy.server@gmail.com.securestring"
  5. $securepassword = get-content -path $passwordfile | convertto-securestring
  6. $emailcredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username,$securepassword
  7.  
  8.  
  9. if ($checkdrives -eq $True) -and ($autoscout -eq $True){
  10.     exit
  11.     }
  12. elseif ($checkdrives -eq $True) -and ($autoscout -eq $False){
  13.     restart-vm Autoscout -force
  14.     }
  15. elseif ($checkdrives -eq $False) -and ($autoscout -eq $True){  
  16.     Send-MailMessage -From afy.server@gmail.com -Subject "Warning: Your Media Drives aren't connected!" -To fv96eujaut@pomail.net -Body "Remote in and check ASAP" -Credential $emailcredential -Port 587 -SmtpServer smtp.gmail.com -UseSsl
  17.     }
  18. else{
  19.     restart-vm Autoscout -force
  20.     Send-MailMessage -From afy.server@gmail.com -Subject "Warning: Your Media Drives aren't connected!" -To fv96eujaut@pomail.net -Body "Remote in and check ASAP" -Credential $emailcredential -Port 587 -SmtpServer smtp.gmail.com -UseSsl
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement