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
# ------------------------------------------------------------------------------------------------------------------------ | |
# Preferences | |
# ------------------------------------------------------------------------------------------------------------------------ | |
# Setting StrictMode to enforce Coding Best Practices. | |
Set-StrictMode -Version 2.0 | |
# Setting the Error Preference variable to stop to make sure that non terminating errors do terminate. | |
$ErrorActionPreference = 'Stop' |
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 | |
Watch Powershell Job progress. | |
.DESCRIPTION | |
This function allows you monitor the progress of the Powershell Jobs you just started, | |
it wil show a progressbar and the remaining jobs that are still running. | |
one of the key features is the ability to stop the other Jobs when 1 is failed. | |
.EXAMPLE | |
Watch-Job -Job $Jobs | |
Shows a progress bar indication how many jobs are completed/still running |
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
Clear-Host #Clearup the console. | |
### Script Output/Error Preferences. | |
#Enable/Disable Verbose Output for Debugging | |
$VerbosePreference = "Continue" #Use either Continue (Show) or SilentlyContinue (Hide) | |
#Stop Script Execution when an error occurs. | |
#Always use Stop!, if you need to bypass this behaviour for a specific command then use the -ErrorAction Parameter with SilentlyContinue for that command. | |
$ErrorActionPreference = "Stop" |
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
### Script Global Settings | |
#Declare SMTP Connection Settings | |
$SMTPConnection = @{ | |
#Use Office365, Gmail, Other or OnPremise SMTP Relay FQDN | |
SmtpServer = 'outlook.office365.com' | |
#OnPrem SMTP Relay usually uses port 25 without SSL | |
#Other Public SMTP Relays usually use SSL with a specific port such as 587 or 443 | |
Port = 587 | |
UseSsl = $true |
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
# Executes the Powershell HTML file, code prefixed with $( and suffixed with ) will be executed. | |
# Part of the Portable Powershell Webserver service/script made by @SteloNLD, Sten Lootens ([email protected]). | |
Function Invoke-PsHTML ($PsHTML_FilePath){ | |
Return Invoke-Expression ('@" | |
' + $(Get-Content $PsHTML_FilePath) + ' | |
"@') | |
} |
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
cls | |
#Services are declared here, but you can of course load them from something like a CSV file. | |
$Servicelist = @("WinRM", "Winmgmt", "DHCP") | |
#Computers are declared here, but you can of course load them from something like a CSV file. | |
$Computerlist = @("LocalHost", "Server1","Server2","Server3") | |
#HashTable, wil store the services with running status for each server, | |
$ServiceStatus = @{} |
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
#requires -version 3 | |
<# | |
.SYNOPSIS | |
Registry Changer | |
.DESCRIPTION | |
Adds predefined registry keys to the windows registry. | |
.PARAMETER UserName | |
Optional, The UserName to use, defaults to $env:USERNAME (the username of the current user) | |
.PARAMETER UserDomain | |
Optional, The UserDomain to use, defaults to $env:USERDOMAIN (the domain of the current user) |