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. |
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
| <# | |
| $step < 0 - left shift | |
| $step = 0 - reverse | |
| $step > 0 - right shift | |
| #> | |
| function Shift-Array { | |
| [cmdletBinding()] | |
| param ( | |
| [Parameter(ValueFromPipeline)] | |
| $Inputobject, |
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 | |
| Creates HTML table from .NET objects. | |
| .DESCRIPTION | |
| This is basic cmdlet, as a helper, to build HTML tables for complex HTML content. | |
| Converts .NET objects into HTML that can be displayed in a Web browser. | |
| This cmdlet works like "ConvertTo-Html -Fragment" but does not have any of its disadvantages, allowing HTML entities in cells, omiting the first column colons and allowing multi-column tables in the List mode, etc. | |
| Features: | |
| - Parameterset autoresolve. There are no predefined parameter sets | |
| - Input data preprocessor: sorting and filtering |
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
| function Get-WindowsVersion ([string]$Computername) { | |
| $params = @{} | |
| if ($computername) { | |
| [uint32]$HKLM = 2147483650 | |
| $winreg = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion' | |
| $params['CimSession'] = New-CimSession -computername $computername -sessionoption (new-cimsessionoption -protocol Dcom) | |
| if (-not $params['CimSession']) { | |
| $params['CimSession'] = New-CimSession -computername $computername -sessionoption (new-cimsessionoption -protocol wsman) | |
| } | |
| if (-not $params['CimSession']) {return} |
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
| # 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
| function Align-Object { | |
| $property = [ordered]@{} | |
| $collection = @($input) | |
| foreach ($obj in $collection) {foreach ($p in $obj.psobject.properties.name) {$property[$p] = 1}} | |
| $collection | Select-Object -property @($property.keys -ne 'Length') | |
| } | |
| function Align-Object1 { | |
| $property = [System.Collections.Generic.HashSet[string]]::new() | |
| $collection = @($input) | |
| foreach ($obj in $collection) {foreach ($p in $obj.psobject.properties.name) {$null = $property.Add($p)}} |
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
| <# | |
| .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
| <# | |
| .SYNOPSIS | |
| Print Service Logger. | |
| .DESCRIPTION | |
| The script reads event log ID 307 and ID 805 from the log "Applications and Services Logs > Microsoft > Windows > PrintService" from the specified server and for the specified time period and then calculates print job and total page count data from these event log entries. | |
| It then writes the output to console, graphic window, or .CSV files, one showing by-print job data and the other showing by-user print job data. | |
| Features: | |
| - Predefined date ranges in StartDate parameter |