This file contains 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
## Usage Examples | |
# | |
### Execute a command on multiple remote computers | |
# .\ops.ps1 -ComputerName Server1, Server2 -Command "Get-Service | Where-Object {`$_.Status -eq 'Running'}" | |
# | |
### Run a script on a remote computer with arguments | |
# .\ops.ps1 -ComputerName Server1 -ScriptPath C:\Scripts\DiskCleanup.ps1 -ArgumentList @{DaysOld = 30; LogPath = "C:\Logs"} | |
# | |
### Copy files to multiple remote computers | |
# .\ops.ps1 -ComputerName Server1, Server2 -Source C:\Updates\Patch.msp -Destination C:\Temp -Recurse |
This file contains 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
# Examples | |
# | |
# Run locally with dry-run mode | |
#.\setRegValues.ps1 -csvFilePath ".\DNSPatternMatches.csv" -dryRun -Verbose | |
# | |
# Run locally | |
#.\setRegValues.ps1 -csvFilePath ".\DNSPatternMatches.csv" | |
# | |
# Run remotely | |
#.\setRegValues.ps1 -csvFilePath ".\DNSPatternMatches.csv" -computerNames "RemoteComputer1", "RemoteComputer2" |
This file contains 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
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$false)] | |
[string]$matchPattern = "\.co\.nz", | |
[Parameter(Mandatory=$false)] | |
[string]$originalString = "dev", | |
[Parameter(Mandatory=$false)] | |
[string]$targetString = "dev2", |
This file contains 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
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$false)] | |
[string]$dnsNamePattern = 'google', | |
[Parameter(Mandatory=$false)] | |
[string[]]$registryPaths = @("HKLM:\SOFTWARE\WOW6432Node\Google"), | |
[Parameter(Mandatory=$false)] | |
[string[]]$excludePaths = @("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Google\Update*"), | |
[Parameter(Mandatory=$false)] | |
[string[]]$computerNames = @("localhost"), |
This file contains 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]$dnsServer, | |
[Parameter(Mandatory=$false)] | |
[string]$lookupZone, | |
[Parameter(Mandatory=$false)] | |
[string[]]$cnameRecords, |
This file contains 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]$dnsName, | |
[Parameter(Mandatory=$false)] | |
[string]$dnsServer, | |
[Parameter(Mandatory=$false)] | |
[string]$lookupZone, | |
This file contains 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 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 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 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. |
NewerOlder