2026/6/1 -#ValidateScript. The ValidateScript attribute lets you define custom validation logic using a script block. The $_ variable represents the value being validated ...
2026/1/13 -You can use $PSItem in the scriptblock of a ValidateScript attribute. When used with ValidateScript, $PSItem is the value of the current object being validated.
2026/11/15 -Example: Is the argument an existing file? ( $_ is the shortcut for the argument, i.e. the input value). Param ( [ValidateScript({ Test ...
2026/2/5 -Critical tip: Always validate parameters with ValidateScript — prevents catastrophic errors from typos in paths. ... # Notification function example
2026/7/7 -The PowerShell scanner in PDQ Connect allows you to collect custom inventory data from devices by running PowerShell scripts and storing the results in a ...
2026/1/22 -Example 2 - Using instantiation syntax. This example defines a Book class with several properties, but no constructor. PowerShell.
2026/1/25 -This script reads a CSV file containing device identifiers and group names, then adds the specified devices to their corresponding Entra ID groups.
2026/8/17 -The example that I will be using is based on one of our many services, this ... [ValidateScript( { $_ -match '^[a-zA-Z0-9.-]+(:[0-9]+)?$' } )]. [String] ...
2026/10/18 -Outputs one result per file; pipe it to Export-Csv to keep a record. .EXAMPLE .\Import-DeviceAssociation.ps1 -Path D:\devicelinks .EXAMPLE.
2026/8/6 -[ValidateSet] gets you tab completion and accepted values in Get-Help for free; [ValidateRange] and [ValidateScript] at least put the constraint somewhere ...