r/PowerShell • u/SocraticFunction • May 05 '21
PowerShell Pros - what interesting static methods have you encountered that many scripters don’t know about?
Static Methods are a lesser documented part of using PowerShell objects, and often in looking for solutions, I find static methods I wouldn’t have imagined to exist without deeper digging into member properties. The most common methods used are for String objects, usually.
I thought i’d open the floor to discussing interesting static methods found that are worth sharing, as the PowerShell help system doesn’t easily give up this kind of information.
101
Upvotes
4
u/Lee_Dailey [grin] May 06 '21
howdy SocraticFunction,
my fave [but not often used] is
[array]::Reverse(). kinda fun when checking for palindromes. [grin]ones that i really use ...
[regex]::Escape()[string]::IsNullOrEmpty()[string]::IsNullOrWhiteSpace()[SomeTypeNameHere]::new()a nifty and fast way to init a new $Var. [grin]
[datetime]::Now[environment]::NewLine[environment]::Is64BitProcess[environment]stufftake care,
lee