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?
function New-ClassDefinitionFromObject { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory)] | |
[object]$InputObject, | |
[Parameter()] | |
[String]$Name = 'Root', | |
[SupportsWildcards()] |
# http://stackoverflow.com/a/5429048/2796058 | |
$ToNatural = { [regex]::Replace($_, '\d+', { $args[0].Value.PadLeft(20) }) } | |
Get-ChildItem | Sort-Object $ToNatural |
Function Get-LocalTime { | |
[cmdletbinding()] | |
Param( | |
[Parameter(Mandatory=$true)] | |
$Address, | |
$Time = (Get-Date), | |
#Get an API key from here: https://developers.google.com/apis-explorer/ | |
$APIKey = (Import-Clixml "$env:USERPROFILE\$ENV:USERNAME-GoogleApi.xml"), |
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 } |
Install-Module <modulename> -scope CurrentUser |
[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' | |
) |
Function Get-PartOfDay { | |
Param ( | |
[int]$Hour = (Get-Date).Hour | |
) | |
Switch ($Hour) { | |
{$_ -in 0..11} {'Morning'} | |
{$_ -in 12..17} {'Afternoon'} | |
{$_ -in 18..23} {'Evening'} | |
} | |
} |
Source: http://www.opsreportcard.com/.
# 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) |
#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) |