Instantly share code, notes, and snippets.

View telnet.ps1
Function Test-Port {
<#
.Synopsis
Do a test for open ports against remote machine
.Description
Will create sample connection to remote machine on specified port (as classic telnet client)
.Parameter Computername
The name of the computer to query. The Input can be piped, it is default 1st parameter
View get-ServiceStatus.ps1
function Get-ServiceStatus {
<#
.Synopsis
List services, their startup type and current status.
.Description
This command will query the Win32_Service class using Get-WmiObject and return list of services.
.Parameter
Computername - The name of the computer to query. This parameter has an alias of CN. The Input can be piped.
Service - query for service name, supports wildcards
View SQL_validation.ps1
Function ExecuteSQLscript {
<#
.Synopsis
Execute SQL script
.Description
will trigger sqlexec.exe and display output
.INPUTS
-SQLscript <[System.IO.FileInfo]string>
View Nagios_Cluster.ps1
$Status= 0
# 0-OK
# 1-Warning
# 2-Error
# 3-Unknown
$ItemName = $null
# This has to be unique per host in NAGIOS
$PerfData = '-'
# varname=value;warn;crit;min;max
View Get-SPWorkflowExecutionStatus
Function mms-SPRunningWorkflows {
<#
.Synopsis
List of running workflows for the site
.Description
Due to running worfklows you can face to various .Net compilation errors. The most know are:
- Could not write to output file ... The Directory is invalid
- The workflow can not run and will be saved only
- etc.
View Get-RemoteAccessFarmUsage.ps1
function mms-RAFarm {
<#
.Synopsis
Get active remote connection thru RRAS and RDS Gateway for the specified servers.
.Description
This command will query the Win32_TSGatewayConnection class using RPC and root/Microsoft/Windows/RemoteAccess using WinRM
and write summary object to the pipeline.
.Parameter Computername
The name of the computer(s) to query. This parameter has an alias of CN. The Input can be piped.
View Get-FolderSize.ps1
Function mms-FolderSize {
<#
.Synopsis
The function will return folder size and list of first level subfolders size.
.Description
The function is simmilar to reskit command "diruse" or unix tool "du". The output is sum value of file sizes
in specified folder and summary siza for each first level subfolder. The function is build up on top of
get-childitem function.
View Get-UptimeParallel.ps1
Function Get-Uptime {
<#
.Synopsis
Get computer uptime.
.Description
This command will query the Win32_OperatingSystem class using Get-CimInstance and write an uptime object to the pipeline.
The function is calling workflow to parallely process all inputs to save some time.
.Parameter Computername
The name of the computer(s) to query. This parameter has an alias of CN. The Input can be piped.
View Test-MultiConnection.ps1
Function Test-Ping {
<#
.Synopsis
Do a simple conncetion test (ping) to specified hosts.
.Description
The command will run "test-connection" again hosts defined in variable. If Single host is specified,
there will run continuos ping, otherwise one packet will be send to all hosts in paralel. The pipe input is supported.
.Parameter ComputerName
The destination name or IP addresses
alias: name, cn