Standard escape codes are prefixed with Escape:
- Ctrl-Key:
^[ - Octal:
\033 - Unicode:
\u001b - Hexadecimal:
\x1B - Decimal:
27
| -------------------------------------------- | |
| Version: 1.45.1 | |
| Commit: 5763d909d5f12fe19f215cbfdd29a91c0fa9208a | |
| Date: 2020-05-14T08:33:47.663Z | |
| Electron: 7.2.4 | |
| Chrome: 78.0.3904.130 | |
| Node.js: 12.8.1 | |
| V8: 7.8.279.23-electron.0 | |
| OS: Darwin x64 18.5.0 | |
| ------------------------------------------- |
| # This example will update a date, person and text column for all items on a board | |
| # It will show you how to query the API (read data) and mutate column values for each of the returned items. | |
| # set URL and headers for API calls | |
| $url = "https://api.monday.com/v2/" | |
| $hdr = @{} | |
| $hdr.Add("Authorization" , "YOUR_API_KEY_HERE") | |
| $hdr.Add("Content-Type","application/json") | |
| # set board ID |
| using namespace system.collections.generic | |
| function Get-ParamBlock ([String[]]$Name) { | |
| [hashset[string]]$params = $PSCmdlet.MyInvocation.MyCommand.Parameters.Keys | |
| $params.ExceptWith([string[]]([PSCmdlet]::CommonParameters + [PSCmdlet]::OptionalCommonParameters)) | |
| $result = @{} | |
| if ($Name) {$params = $params -in $Name} | |
| foreach ($name in $params) { | |
| $result.$name = $PSCmdlet.GetVariableValue($name) | |
| } | |
| return $result |
| using namespace System.Management.Automation | |
| using namespace Microsoft.PowerShell.Commands | |
| function Write-FunctionError { | |
| <# | |
| .SYNOPSIS | |
| Writes an error within the context of the containing CmdletBinding() function. Makes errr displays prettier | |
| #> | |
| param( | |
| [Parameter(Mandatory)][String]$Message, | |
| [ValidateNotNullOrEmpty()][ErrorCategory]$Category = 'WriteError', |
| using namespace System.Threading.Tasks | |
| using namespace System.Collections.Generic | |
| filter Receive-Task { | |
| #Wait on one or more tasks in a cancellable manner | |
| [CmdletBinding()] | |
| param( | |
| [parameter(Mandatory, ValueFromPipeline)][Task]$Task, | |
| #How long to wait before checking for a cancellation in milliseconds | |
| [int]$WaitInterval = 500 | |
| ) |
A PowerShell 7 pre commit hook to lint your PowerShell code using the PSScriptAnalyzer module.
| # Add a domain user to a remote server local group, if your current user has admin over the remote machine | |
| powershell -c ([ADSI]'WinNT://SERVER/Administrators,group').add('WinNT://DOMAIN/USER,user') | |
| # Get all local groups on a remote server | |
| powershell -c "([ADSI]'WinNT://SERVER,computer').psbase.children | where { $_.psbase.schemaClassName -eq 'group' } | foreach { ($_.name)[0]}" | |
| # Find members of the local Administrators group on a remote server | |
| powershell -c "$([ADSI]'WinNT://SERVER/Administrators,group').psbase.Invoke('Members') | foreach { $_.GetType().InvokeMember('ADspath', 'GetProperty', $null, $_, $null).Replace('WinNT://', '') }" | |
| # Enable the local Administrator account on a remote server |
We need our software builds to label the software with a version number.
We want each build to produce a label that is unique enough that we can track a binary back to it's build and the commit it was based on.
We want to follow "Semantic Versioning" because our industry as a whole has decided it's useful.
We want the version number to be predictable, so that (as developers) we know what version of the software we're working on.
| <# | |
| .SYNOPSIS | |
| Diffrent methods for displaying relative path | |
| #> | |
| # Existing Path | |
| $PWD | Resolve-Path -Relative | |
| # Replace String | |
| $Path -replace [regex]::Escape((Get-Location).Path), '.' |