January 29, 2018

PowerShell - Generate GUID

This PowerShell script uses NewGuid() method of the .Net Framework guid class to generate a Globally Unique Identifier. You can generate 1 GUID by running the script or specify how many GUID’s you want. See example below.

PS C:\> .\generate-guid.ps1

PS C:\> .\generate-guid.ps1 3

January 16, 2018

PowerShell - Monitoring Windows Service

This PowerShell script checks specific Windows Service. If service is in a stopped state script starts it and creates a log file.

Script usage example:
.\MonitorWindowsService.ps1 -ServiceName "SNMP Trap" -IntervalSeconds 30

Script above checks SNMP Trap service every 30 seconds. Any changes to the service state will be logged in “SNMP Trap_log.txt” file.