In this video, we build on DevOps Repos by crating a PowerShell file and running it within a PowerShell based DevOps pipeline. A pipeline is an automation tool built into Azure DevOps that supports continuous integration, continuous development (CI/CD). We review creating a starter pipeline, edit the pipeline to conclude inline PowerShell commands and a PowerShell Script. We then add variables to the pipeline and change the trigger to only run manually.Continue reading “Azure DevOps and PowerShell Pipelines”
As promised, here is the safe restart PowerShell script version that includes writing output to the Event Log.
I used the Write-Eventlog command to get the output into the event log. I started by defining the variables. The eventID and eventSource can be anything, eventLog and eventType need to match the parameters of the Write-Eventlog command.
#eventlog vars $eventLog = "System" $eventType = "Information" $eventID = 212 $eventSource = "SafeRestart"
This is a script that reboots if day and time criteria are met and if the uptime is less than a given number of days.
I had, what I thought, was a simple request. I wanted any servers that had not rebooted as part of the monthly SCCM patch cycle to reboot at the end of the maintenance window. This way I know that the servers don’t have any unfinished patching and the servers have a reboot in the last 30 days. These are Windows servers and I’m old school, I like to routinely reboot them. Continue reading “Safe Restart Script”