Powershell

Managing Lenovo BIOS Settings (Part 4)

In the previous tip we showed how you can read and change BIOS settings for Lenovo computers. This was the code to disable WakeOnLan, for example:...

Managing Lenovo BIOS Settings (Part 3)

In the previous tip we explained how to manage Lenovo BIOS settings from PowerShell. Typically, there are single settings that need to be managed....

Managing Lenovo BIOS Settings (Part 1)

There is unfortunately no standardized way of managing BIOS settings for computer vendors. Each vendor employs proprietary approaches. For Lenovo...

Exploring PowerShell Modules

Most cmdlets and functions are part of PowerShell modules. If you’d like to explore where exactly these commands come from, here is an easy...

Locking Workstation

If you’d like to lock the current workstation from within PowerShell, you can take advantage of the fact that PowerShell can run executables....

Detecting WinPE

PowerShell can run inside WinPE environments. If you’d like to detect whether your PowerShell script runs inside a WinPE environment, you can...

Dumping ZIP Archive Content

PowerShell comes with new cmdlets like Extract-Archive that can extract (all) files from a ZIP file container. However, there is no way to just list...

Validating Variable Content

Beginning in PowerShell 5, you can assign a validator to a variable. The validator can take a regular expression, and once you assign new values to...

Using Profile Scripts

PowerShell by default “forgets” most settings on restart. If you’d like to “keep” settings, you use a profile script....

Optimizing Command Completion

The PowerShell console (powershell.exe, pwsh.exe) offers extensive completion support. When you enter a command and then add a space and a hyphen,...

Reading Registry Remotely (Part 2)

In the previous example we showed the code required to read registry values remotely from another machine using the old-fashioned DCOM protocol. If...

Reading Registry Remotely (Part 1)

If you cannot use PowerShell remoting, and you need to read registry values from another system via DCOM, here is some example code you might want...

Manipulating Registry User Hive

Reading and writing values to the HKEY_LOCAL_USER hive in the registry is easy, because this hive is the same for all users. How would you read or...

Managing Windows Features (Part 2)

In Windows 10, unlike in Windows Server, you cannot use the Get-WindowsFeature and Add-WindowsFeature cmdlets to manage Windows features. However,...

Managing Windows Features (Part 1)

Windows 10 comes with a vast number of features, and only a subset is installed. Manually, you would open Control Panel and look at the Windows...

Running CMD commands in PowerShell

PowerShell by default does not support the native cmd.exe command such as „dir“. Instead, it uses historic aliases called...

Getting Excuses Automatically

Invoke-WebRequest can retrieve HTML info from web pages, and regular expressions can then scrape information from these pages. Here is some code...

Finding Windows Build Numbers

When you run winver.exe, you can easily retrieve the full Windows build number. Reading the build number from PowerShell is not as obvious. There is...

Checking for USB Devices

If you’d like to know whether a specific device is attached to your computer, you can use WMI to dump the names of all plug&play devices:...

Using PSGraph

PSGraph is an awesome free PowerShell library that you can use to visualize relationships. Before you can use PSGraph, you need to install its...

Using AD Filters with Cmdlets (Part 4)

In the previous tip we started to look at how cmdlets from the ActiveDirectory module (part of the free RSAT tools) can filter results, and looked...

Using AD Filters with Cmdlets (Part 3)

In the previous tip we started to look at how cmdlets from the ActiveDirectory module (part of the free RSAT tools) can filter results, and started...

Using AD Filters with Cmdlets (Part 2)

In the previous tip we started to look at how cmdlets from the ActiveDirectory module (part of the free RSAT tools) can filter results. You learned...

Using AD Filters with Cmdlets (Part 1)

The free RSAT tools come with the ActiveDirectory PowerShell module. You can use the cmdlets from this module to retrieve AD information such as...

Creating Temp File Names

Whenever you write information to disk, it makes sense to use unique temporary file names. If you use static file names and run your code more than...

File System Stress Test

If you’d like to generate super large files for stress test purposes, you don’t have to waste time pumping data into a file to make it...

1 23 24 25 26 27 104