Powershell

Greetings of the Day

Here is a simple approach that takes an array of strings and returns a random string that you could use for custom greetings in PowerShell:...

read more

Flush DNS Cache

Windows is using a DNS cache, so when you change DNS servers, you need to flush the cache before the new settings take effect. PowerShell is a...

read more

Displaying Folder Tree

PowerShell is a friend with old console commands, so the easiest way of displaying the tree structure of a folder is the old “tree”...

read more

Using Cached Port File

In the previous tip we explained how you can download port assignments via PowerShell from IANA. This process requires Internet access and can take...

read more

World Time Clock

PowerShell 5 comes with Get-TimeZone which returns all defined time zones and their time offset. This is all you need for a one-liner world clock:...

read more

Setting Time Zone

While you need administrative privileges to adjust time and date on your computer, each user can change the time zone, i.e. when you travel....

read more

Force Client Time Resync

If your client does not sync time correctly with your domain controller, try the code below. It does require Admin privileges: w32tm.exe /resync...

read more

Mapping Network Drives

PowerShell offers numerous ways to connect to SMB file shares. Here are three different approaches: # adjust path to point to your file share...

read more

Safely Deleting Data

To safely delete files, folders, or entire drives, PowerShell can use the built-in cipher.exe tool. This line would safely delete the old user...

read more

Validating Variables

Variables and function parameters can be automatically validated through validation attributes. Here is a simple example making sure $test1 can only...

read more
1 42 43 44 45 46 130