This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [string]$ServiceNamePattern # Input parameter to match service names using regex | |
| ) | |
| # Get all services matching the pattern | |
| $services = Get-Service | Where-Object { $_.Name -match $ServiceNamePattern } | |
| # Iterate through each matching service | |
| foreach ($service in $services) { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [Parameter(Mandatory = $false)] | |
| [string[]]$CnameList, | |
| [Parameter(Mandatory = $false)] | |
| [string]$CnameListFilePath, | |
| [Parameter(Mandatory = $true)] | |
| [string]$TargetHostname, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [string]$dnsNamePattern = '.*\.co\.nz$' # Regex to match DNS names ending with '.co.nz' | |
| ) | |
| # Define the registry paths to check | |
| $registryPaths = @("HKLM:\SOFTWARE", "HKLM:\SYSTEM", "HKLM:\SECURITY") | |
| # Create an array to store the results | |
| $results = @() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| Manages the recovery options of Windows services. | |
| .DESCRIPTION | |
| This script can retrieve or set the recovery options of specified Windows services using the `sc.exe` utility. It supports operations on multiple services at once by accepting service names with wildcards or regex patterns. The script allows for configuring how the service responds to first, second, and subsequent failures. | |
| .PARAMETER ServiceNames | |
| Array of service names or patterns to match against existing services. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param ( | |
| [Parameter(Mandatory = $true)] | |
| [string]$dnsServer, | |
| [Parameter(Mandatory = $true)] | |
| [string[]]$lookupZones, | |
| [Parameter(Mandatory = $true)] | |
| [string[]]$specificServerNames | |
| ) | |
| function Get-CNameRecords { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [string[]]$Servers = @($env:COMPUTERNAME), # Defaults to the local computer | |
| [int]$DaysAgo = 1, | |
| [string[]]$LogNames = @("Application", "System"), | |
| [ValidateSet("Critical", "Error", "Warning", "Information", "Verbose")] | |
| [string[]]$LogLevels = @("Critical", "Error", "Warning"), | |
| [string]$OutputHTML = "EventLogReport.html" | |
| ) | |
| # Ensure PSWriteHTML is available |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| Retrieves Windows event logs from local or remote servers based on specified filters. | |
| .DESCRIPTION | |
| This script queries Windows event logs from specified servers, filtering by log name, provider name, event level, and text match within events. Results can be displayed in the console or exported to a CSV file. | |
| .PARAMETER Servers | |
| Specifies an array of server names from which to query the event logs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [ValidateSet("Check", "Enable", "Disable")] | |
| [string]$Action = "Check", | |
| [ValidateSet("SMB1", "SMB2", "All")] | |
| [string]$SMBVersion = "All" | |
| ) | |
| function Check-SMBStatus { | |
| Write-Host "Checking SMB protocol status..." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [switch]$ExportToCsv, | |
| [string]$CsvPath = "C:\ports_info.csv" | |
| ) | |
| function Get-TcpConnections { | |
| try { | |
| $connections = Get-NetTCPConnection | |
| $processes = Get-Process |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [switch]$ExportToCsv | |
| ) | |
| # Attempt to execute 'dotnet --info' and capture the output | |
| try { | |
| $dotnetInfo = & dotnet --info 2> $null | Out-String | |
| } catch { | |
| $dotnetInfo = $null | |
| } |