ps1

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

Searching for ADUsers

The free Microsoft RSAT tools come with the PowerShell “ActiveDirectory” module: plenty of cmdlets help you administer Active Directory...

read more

ToString() Masquerade

In the previous tip we explained that ToString() is a fuzzy way of describing an object, and that the object author can decide what ToString()...

read more

Careful with ToString()

Any .NET object has a method ToString() that returns a text representation. This is also what you get when you output an object in a string....

read more
1 39 40 41 42 43 128