One quick way to determine the name of the domain you are connected to is WMI: PS> Get-CimInstance -ClassName Win32_NTDomain DomainName...
ps1
Simple Built-In Password Generator
There is a hidden gem in the .NET System.Web assembly which lets you create random passwords of any length in no time: # total password length...
Creating Dummy Test Files
If you need to test file system load, test failover clusters, or need large dummy files otherwise, rather than creating new files and slowly filling...
Reading HTTP Headers from Websites
When you navigate to a web page, your browser silently receives meta information inside the HTTP header which is typically invisible. To display the...
Using FTP: Uploading File (Part 4)
PowerShell does not come with cmdlets to download and upload data via FTP. However, you can use .NET for this. To upload a file from your local...
Using FTP: Downloading Binary File (Part 3)
PowerShell does not come with cmdlets to download and upload data via FTP. However, you can use .NET for this. To download a file from an FTP server...
Using FTP: Downloading File (Part 2)
PowerShell does not come with cmdlets to download and upload data via FTP. However, you can use .NET for this. To download a file from an FTP...
Using FTP: Listing Folders (Part 1)
PowerShell does not come with cmdlets to download and upload data via FTP. However, you can use .NET for this. To display the contents of an FTP...
Discovering Public IP Address
Using a web service, it is almost trivial to determine your public IP address and information about your ISP: PS> Invoke-RestMethod -Uri...
Displaying Warning Dialog (Part 2)
In the previous tip we created new shortcut files, and you have seen how the CreateShortcut() method provides methods to control almost any detail...
Displaying Warning Dialog (Part 1)
Here is a quick code sample that displays a popup warning dialog: Add-Type -AssemblyName System.Windows.Forms $message = 'Your system will...
Error Handling for Console Commands
Occasionally it is useful and even necessary to use console applications in PowerShell scripts. In the previous tip, for example, we looked at ways...
Removing Network Drives
While Remove-PSDrive can remove all kinds of drives including network drives, changes may not take effect until the system reboots. That’s of...
Listing Network Drives
There are many ways to list mapped network drives. One of them uses PowerShell’s Get-PSDrive and checks to see whether the target root starts...
Reading Printer Properties (Part 3)
In previous tips we looked at how you can use Get-PrinterProperty to read printer properties for locally installed printers. This cmdlet is part of...
Reading Printer Properties (Part 2)
In the previous tip we looked at Get-PrinterProperty which is part of the PrintManagement module and available on Windows operating systems. In this...
Reading Printer Properties (Part 1)
You probably know Get-Printer which returns the names of all installed printers on a system. However, you can’t get specific printer features...
Enable Telnet on Windows 10
A telnet client comes with every Windows 10 version but it is initially hidden. To enable the telnet client, run this command with full Admin...
Managing Shortcut Files (Part 3)
In the previous tip we created new shortcut files, and you have seen how the CreateShortcut() method provides methods to control almost any detail...
Managing Shortcut Files (Part 2)
In the previous tip we created new shortcut files, and you have seen how the CreateShortcut() method provides methods to control almost any detail...
Managing Shortcut Files (Part 1)
PowerShell creates new LNK files and edits existing ones with the help of an old COM object. Let’s first find all LNK files anywhere in your...
Unlock Additional PowerShell Modules in Windows 10
Windows 10 comes with a number of PowerShell modules that you can use to control Server functionality - like WSUS Update Management which is only...
Enabling ActiveDirectory Module
Windows 10 ships with the ActiveDirectory PowerShell module – it may just not be enabled yet. If you would like to use PowerShell cmdlets for...
Forensic Event Log Analysis (Part 2)
In the previous tip we looked at Get-EventLog to do a forensic analysis and find search-related errors in the Application log. Get-EventLog is...