This file contains hidden or 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
| # safe (culture invariant) date format - ISO 8601 - YYYY-MM-DD | |
| [datetime]::now.tostring('yyyy-MM-dd') |
This file contains hidden or 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 | |
| Performs parallel processing of input objects. | |
| .DESCRIPTION | |
| Simple PowerShell function to asynchronously run jobs. | |
| Yet another parallel processing manager on Earth. | |
| FEATURES: | |
| - no modules, just one small self-sufficient function | |
| - automatic scriptblock variables: $_, $psitem |
This file contains hidden or 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
| # Quick GPO Report for further analysis | |
| param ( | |
| [string]$csv, | |
| [alias('xlsx')][string]$excel | |
| ) | |
| $gporeport = { | |
| $domain = $env:USERDNSDOMAIN | |
| if (-not $domain) {return} | |
| #$dommask = "$domain/" -replace '\.','\.' |
This file contains hidden or 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
| # DEMO: caching calculations demo - superfast | |
| # reverse calculations | |
| function fibonacciR ([Double]$fn, [switch]$series, $fbcache) { | |
| #if ($MyInvocation.MyCommand.name -ne $(Get-PSCallStack)[1].FunctionName) { | |
| # $fbcache = $null # prevent using $fbcache from root | |
| #} | |
| if ($fbcache -eq $null) {$fbcache = [System.Collections.Generic.Dictionary[string,Double]]::new($fn)} | |
| if ($fbcache.ContainsKey($fn)) {$fbcache[$fn]} | |
| elseif ($fn -lt 2) { | |
| $fbcache[$fn] = $fn |
This file contains hidden or 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 | |
| Displays an asynchronous progress bar within a PowerShell command window. | |
| .DESCRIPTION | |
| A simple one-level asynchronous wrapper over the builtin PowerShell progress bar. | |
| Features: | |
| - Non-blocking screen output | |
| - Separate run phases: start,next,stop | |
| - Automatic percentage calculation | |
| - Automatic state control |
This file contains hidden or 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 | |
| Reads SMART info from supporting SATA drives. | |
| .PARAMETER CimSession | |
| Specifies an existing CIM session or a computername. By default the script works on local computer. | |
| .PARAMETER NoEmpty | |
| Indicates to exclude drives without SMART information from output. | |
| .EXAMPLE |
This file contains hidden or 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
| [PSCustomObject]@{} | select-object q,w,e,r | gm | |
| TypeName: Selected.System.Management.Automation.PSCustomObject | |
| Name MemberType Definition | |
| ---- ---------- ---------- | |
| Equals Method bool Equals(System.Object obj) | |
| GetHashCode Method int GetHashCode() | |
| GetType Method type GetType() | |
| ToString Method string ToString() |
This file contains hidden or 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
| # Classic edition v1 | |
| function Split-DistinguishedName { | |
| param ( | |
| [alias('dn')][string]$distinguishedName, | |
| [alias('leaf')][switch]$cn, | |
| [alias('parent')][switch]$ou, | |
| [switch]$path | |
| ) | |
| if (-not $distinguishedName) {return} | |
| $dnpart = $distinguishedName -split '(,DC=)|(,OU=)|(,CN=)',2 |
This file contains hidden or 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
| param ( | |
| [alias('update','install','apply')] | |
| [switch]$run, # action mode | |
| [switch]$force # skips edition limitation | |
| ) | |
| If ($PSVersionTable.PSVersion.Major -ge 7) { | |
| Write-Error 'This script needs be run by version of PowerShell prior to 7.0' | |
| } |
This file contains hidden or 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
| <# | |
| Event ID Meaning | |
| 00 The log was started. | |
| 01 The log was stopped. | |
| 02 The log was temporarily paused due to low disk space. | |
| 10 A new IP address was leased to a client. | |
| 11 A lease was renewed by a client. | |
| 12 A lease was released by a client. | |
| 13 An IP address was found to be in use on the network. | |
| 14 A lease request could not be satisfied because the scope's address pool was exhausted. |
OlderNewer