Powershell

Get French Holidays

I saw this blog post and I decided to publish this one for France. Here is a PowerShell function that gets all French holidays…

Get German Holidays

Here is a PowerShell function that gets all German holidays, either nationwide or just for your state: function Get-GermanHoliday {    param    (...

Finding Start Time Degradation

With Administrator privileges, a Windows system provides access to the diagnostic data gathered during startup. Windows logs the start time and...

Managing File Shares

Creating a new file share for your network requires Administrator privilege and this PowerShell code: $Parameters = @{ Name = "Packages" Path =...

Masked Input

To safely enter input, scripts need to display a masked input. The easiest way to do this is to use Read-Host -AsSecureString: # Read-Host $entered...

Automating Control Panels

Windows Control Panel is the GUI center for any system configuration. You can launch control panel via console command, too: control [ENTER]....

Avoid Get-EventLog

Get-EventLog is a highly popular cmdlet in Windows PowerShell. With just a few simple parameters, it reads event logs from the primary Windows event...

Composing Dates from a DateTime

Here is a simple and generic way to turn DateTime information into just the ISO string data components you require. For example, if you just need...

Choosing Best File Format (Part 4)

In the previous parts, we reviewed different file types to persist data and cmdlets to read and write them. Today, let’s apply this to a real-world...

Choosing Best File Format (Part 3)

Publishing on – Thur June 22 PowerShell supports a wide variety of text file formats, so what’s the best way to save and read data? In the first two...

Choosing Best File Format (Part 2)

PowerShell supports a wide variety of text file formats, so what’s the best way to save and read data? This largely depends on the type of data, so...

Choosing Best File Format (Part 1)

PowerShell supports a wide variety of text file formats, so what’s the best way to save and read data? This largely depends on the type of data, so...

Test-Driving PowerShellGet Version 3

PowerShellGet is a module and contains important cmdlets such as Install-Module, so this module is really the prerequisite for downloading and...

Getting Parent Culture

Most of the time, localized resources are tagged with a culture name such as “en-us” or “de-de”. If you’d like to know what such an ID stands for,...

Invoke-RestMethod Cancellation Issues

Both Invoke-WebRequest and Invoke-RestMethod are simple-to-use cmdlets to download information from the web. For example, this simple code can query...

Two Type Casts (and one bug)

To explicitly convert one data type to another, PowerShell offers two ways: PS> [int]5.6 6 PS> 5.6 -as [int] 6 While both approaches yield identical...

Mounting ISO Files

In our previous tip we showed how you can easily turn local folders into ISO file images. Today, we look at how you can mount (and dismount) your...

Creating ISO Files

PowerShell can turn regular folders into ISO files. ISO files are binary files that can be mounted and then behave like a read-only CD-ROM drive. In...

Progress Bar Tricks (Part 4)

Due to popular request, here is a code that illustrates how you can use nested progress bars and show a "real" progress indicator for each task your...

Progress Bar Tricks (Part 3)

PowerShell's built-in progress bar can be nested, showing one progress bar per task. For this to work, assign distinct ID numbers to your progress...

Progress Bar Tricks (Part 2)

Publishing on – Mon May 15 The built-in PowerShell progress bar supports a “real” progress indicator provided you submit a “percentCompleted” value...

Progress Bar Tricks (Part 1)

PowerShell comes with a built-in progress bar. It typically automatically disappears when your script is done: Write-Progress -Activity 'I am busy'...

Listing Active Domain Controller

If your machine is connected to a domain, you can use PowerShell to identify the domain controller you are connected to. Either use this command:...

1 2 3 104