Archive | PowerShell RSS feed for this section

PowerShell: Finding Built-In Cmdlets

In times where cmdlets can originate from all kinds of modules, it sometimes becomes important to find out which cmdlets are truly built into PowerShell and which represent external dependencies. One way of getting a list of built-in cmdlets is to temporarily open another runspace and enumerate its internal cmdlet list: $ps = [PowerShell]::Create() $ps.Runspace.RunspaceConfiguration.Cmdlets […]

Continue Reading →

PowerShell: Finding IP Address

There are various ways to determine the IP address that is assigned to your machine. Here is a rather unusual approach that uses text operators to filter the information out of the results provided by ipconfig.exe. This is not the most solid way of getting to an IP address. It is, however, an interesting brain […]

Continue Reading →

PowerShell: Creating Custom Objects

If you want to create your own custom objects, for example, to enable your functions to return rich objects, you can always use Select-Object like this: PS> $newobject = ‘dummy’ | Select-Object -Property Name, ID, Address Then, you can fill in the properties and use the object: PS> $newobject = ‘dummy’ | Select-Object -Property Name, […]

Continue Reading →

PowerShell: Check Windows License Status

In PowerShell, you can directly access the raw licensing data like this: PS> Get-WmiObject SoftwareLicensingService You can also check the license status of your copy of Windows: PS> Get-WmiObject SoftwareLicensingProduct | Select-Object -Property Description, LicenseStatus | Out-GridView And you can find out which Windows SKU you are actually using: PS> Get-WmiObject SoftwareLicensingProduct | Where-Object { […]

Continue Reading →

PowerShell: Resetting Console Colors

If a console application or script has changed the console colors and you want to reset them to the default colors defined in your console properties, try this: PS> $host.ui.RawUI.ForegroundColor = ‘Red’ Now, the foreground color is red. Revert it back to standards: PS> [Console]::ResetColor() Note that this will work in a real console only. […]

Continue Reading →

PowerShell: Downloading Files from Internet

PowerShell v3 comes with a hugely useful new cmdlet called Invoke-WebRequest. You can use it to interact with websites which also includes downloading files. This will download the SysInternals suite of tools to your computer: $Source = ‘’ $Destination = “$env:temp\” Invoke-WebRequest -uri $Source -OutFile $Destination Unblock-File $Destination Since downloaded files are blocked by Windows, […]

Continue Reading →
revia in alcoholism