ps1

Dealing with %ERRORLEVEL%

All PowerShell versions When you run native EXE console commands inside your scripts, these commands typically return a numeric return value. This...

read more

Compacting Paths

[WindowsAPILib.Helper _i="0" _address="0" theme_builder_area="post_content" /][WindowsAPILib.Helper _i="1" _address="1"...

read more

Creating Huge Dummy Files

All PowerShell versions If you need to stress test systems, or need large dummy files for other purposes, here is some code that can create even...

read more

Cloning NTFS Permissions

All PowerShell Versions Here is some simple code that reads the NTFS permissions from one folder and applies the exact same settings to another....

read more

Using WMI Inheritance

All Versions WMI classes are inherited from each other, and that’s something you can take advantage of. Take this line: PS> Get-WmiObject...

read more

Finding Process Owners

All PowerShell versions To find out who owns a particular process and how many instances are running, try this simple piece of code: $ProcessName =...

read more

Parsing DISM Log File

PowerShell 2.0 and later In your Windows folder, you find all kinds of system log files. One is DISM.log which contains information about the...

read more

Removing AD Group Members

Module ActiveDirectory To remove one or many users from an Active Directory group, try this approach: $user = @() $user += Get-ADUser -Filter { Name...

read more

NULL Values in Arrays

All PowerShell versions Whenever you assign NULL values to array elements, they will count as array elements, but will not be output (after all,...

read more

Finding Out Windows Version

All PowerShell Versions Do you own Windows 8.1 Basic, Pro, or Enterprise? Finding out the Windows version is easy. Finding out the exact subtype is...

read more
1 65 66 67 68 69 128