Description: List of best practices for Windows PowerShell
PowerShell Best Practice #1: Use full cmdlet name in scripts (not alias)
PowerShell Best Practice #2: Use named parameter in scripts (not positional and partial parameter)
PowerShell Best Practice #3: Avoid Write-Host
PowerShell Best Practice #4: Use CIM cmdlet (not WMI cmdlet)
PowerShell Best Practice #5: Avoid excessive comments (over-commenting)
PowerShell Best Practice #6: Use singular noun for cmdlet (not plural noun)
PowerShell Best Practice #7: Use approved verb for cmdlet (not unapproved verb)
PowerShell Best Practice #8: Use WhatIf and Confirm parameters
PowerShell Best Practice #9: Use custom folding regions
PowerShell Best Practice #10: Avoid empty Catch block
PowerShell Best Practice #11: Use Set-StrictMode in your dev scripts
PowerShell Best Practice #12: Avoid Out-Null cmdlet
PowerShell Best Practice #13: Avoid double quotes in strings if not necessary
PowerShell Best Practice #14: Specify the extension for applications
PowerShell Best Practice #15: Execute scripts with -NoProfile parameter
PowerShell Best Practice #16: Update the help
PowerShell Best Practice #17: Use the same parameter name than the native one
PowerShell Best Practice #18: Don’t use Notepad as a script editor
PowerShell Best Practice #19: Check parameters with PSBoundParameters
PowerShell Best Practice #20: Use full key name for calculated properties
PowerShell Best Practice #21: Use #Requires statement
PowerShell Best Practice #22: Use Obsolete attribute for backwards compatibility
PowerShell Best Practice #23: Avoid the horizontal scrolling (too long one-liners commands)
Hello Guru,
I am new in powershell scripting.
SQL query with having multiple joining of sql tables and have a code to display report to send report with html format
Trying to count between two field like IP4EndIP and IP4StartIP .
using to convert both fields but not getting output of total count of between to IP range
I have use below command for count of IP (e.g. count = 151.169.201.179 – 151.169.200.205 )
$availableIPs = [convert]::toInt32((toBinary $IPv4Ranges[1].EndIPv4Address),2) – [convert]::toInt32((toBinary $IPv4Ranges[1].BeginIPv4Address),2) + 1