Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # skripta za backup solidworksa i slanje konfirmacijskog maila
- # verzija 1
- # autor: vlebo
- # mail notifikacije prije stopiranja servisa
- $hostname = hostname
- $smtpServer = 'goemail.goe-group.com'
- $from = "administrator@goe-group.com"
- $recipients = 'alert@goe-group.com'
- $Subject = "Restarting SolidWorks Service on $hostname"
- $body = "This is an automated message to confirm that the Solid Works Server service on $hostname
- is about to be restarted as part of scheduled backup, please ignore any alerts
- for the next 30 minutes from this service."
- Send-MailMessage -To $recipients -Subject $Subject -Body $body -From $from -SmtpServer $smtpServer
- # stopiranje servisa
- Stop-Service -Name 'PDMWorks Workgroup Server'
- "PDM server stopped"
- # pokretanje sinhronizacije
- & 'C:\Program Files (x86)\Create Software\Create Synchronicity\Create Synchronicity.exe' /run "SWvaultBCK" /log /quiet
- "Sync initiated!"
- while (Get-Process 'Create Synchronicity' -ErrorAction silentlycontinue) { }
- # startanje servisa
- Start-Service -Name 'PDMWorks Workgroup Server'
- "PDM server started!"
- # Mail konfirmacije da je servis ponovno startan
- Start-Sleep -s 5
- $checkService = Get-Service -Name 'PDMWorks Workgroup Server'
- if ($checkService.Status -ne "Stopped"){
- $hostname = hostname
- $smtpServer = 'goemail.goe-group.com'
- $from = "administrator@goe-group.com"
- $recipients = 'alert@goe-group.com'
- $Subject = "PDMWorks Workgroup Server started Successfully on $hostname"
- $body = "This mail confirms that the PDMWorks Workgroup Server service on $hostname is now running. "
- Send-MailMessage -To $recipients -Subject $Subject -Body $body -From $from -SmtpServer $smtpServer }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement