Source: http://www.opsreportcard.com/.
- Are user requests tracked via a ticket system?
- Are "the 3 empowering policies" defined and published?
- How do users get help?
- What is an emergency?
$requestBody = Get-Content $req -raw | |
$requestBody = $requestBody.Replace('&',"`n") | |
$requestBody = ConvertFrom-StringData -StringData $requestBody | |
$Response = (Import-CSV "D:\home\site\wwwroot\Glossary\Glossary.csv") | Where-Object {$_.Term -like "$($requestBody.text)*"} | |
if(!$Response){Out-File -Encoding Ascii -FilePath $res -inputObject "Sorry, there is no match in the Glossary for *$($requestBody.text)*."} | |
$Response | ForEach-Object{ | |
Out-File -Encoding Ascii -FilePath $res -inputObject "*$($_.Term):* $($_.Description)" -Append |
#Adapted from here http://mikefrobbins.com/2012/08/30/finding-aliases-for-powershell-cmdlet-parameters/ | |
(get-command *).parameters.values | select name,aliases | sort aliases -unique | sort name | |
Function Get-XKCD{ | |
[cmdletbinding(DefaultParameterSetName=’Specific’)] | |
Param ( | |
[Parameter(ParameterSetName=’Specific’,ValueFromPipeline=$True,Position=0)][int[]]$Num, | |
[Parameter(ParameterSetName=’Random’)][switch]$Random, | |
[Parameter(ParameterSetName=’Random’)][int]$Min = 1, | |
[Parameter(ParameterSetName=’Random’)] | |
[int]$Max = ((Invoke-WebRequest "http://xkcd.com/info.0.json").Content | ConvertFrom-Json).num, | |
[Parameter(ParameterSetName=’Newest’)][int]$Newest, | |
[switch]$Download |
#Get stats on length of the cmdlet name such as max, min, average, sum | |
Get-Command | where CommandType -eq cmdlet | select -ExpandProperty name | measure length -Average -Sum -Max -Min | |
# See the list, sorted by length | |
Get-Command | where CommandType -eq cmdlet | select -ExpandProperty name | sort length | |
#Another way to get this statistic using calculated properties | |
Get-Command | where CommandType -eq cmdlet | select name,@{N='length';E={$_.name.length}} | measure length -Average -Sum -Max -Min | |
# See the list this way, sorted by length (we can skip the select and use the expression in sort) |
# Required module - BuildHelpers: https://github.com/RamblingCookieMonster/BuildHelpers | |
[cmdletbinding()] | |
Param( | |
[string]$PSGalleryKey = (Import-Clixml PSGalleryKey.xml), #So I don't put it on the internet. | |
[string]$Module, | |
[string]$Version, | |
[switch]$Publish | |
) | |
$ModuleData = (Get-Module $Module) |
Source: http://www.opsreportcard.com/.
Function Get-PartOfDay { | |
Param ( | |
[int]$Hour = (Get-Date).Hour | |
) | |
Switch ($Hour) { | |
{$_ -in 0..11} {'Morning'} | |
{$_ -in 12..17} {'Afternoon'} | |
{$_ -in 18..23} {'Evening'} | |
} | |
} |
[cmdletbinding()] | |
Param( | |
[Parameter(Mandatory=$True)] | |
[string]$ModuleName, | |
[string]$Path = "C:\Users\$env:UserName\Documents\Code\$ModuleName", | |
[string]$Author = 'Mark Wragg', | |
[string]$Description = '', | |
[version]$PSVersion = '3.0' | |
) |
Install-Module <modulename> -scope CurrentUser |
Function Get-OrdinalNumber { | |
Param( | |
[Parameter(Mandatory=$true)] | |
[int64]$num | |
) | |
$Suffix = Switch -regex ($Num) { | |
'1(1|2|3)$' { 'th'; break } | |
'.?1$' { 'st'; break } | |
'.?2$' { 'nd'; break } |