PowerShell for Windows Admins:

July, 2017


July 31, 2017  2:20 PM

PowerShell documentation

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

The home of Microsoft’s PowerShell documentation is changing from MSDN to https://docs.microsoft.com The PowerShell documentation is currently opened sourced at https://github.com/powershell/powershell-docs This change makes accessing the documentation easier

July 27, 2017  6:08 AM

You have to laugh

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Sometimes things just happen and you have to laugh. So I decided I wanted to get back to working with the Windows 10 Insider previews (and Windows Server previews). This time I decided to use VMs rather than my working machine so that interruptions were minimised. I created a new Windows 10...


July 20, 2017  4:11 AM

Unblock and rename files

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

I have a bunch of files that I’ve downloaded to a specific folder. I need to unblock and rename files in that folder. The rename involves replacing a plus sign with a space.

$path = 'C:\Users\Richard\Downloads\Walks'

$files = Get-ChildItem -Path $path -File

foreach ($file in $files) {...


July 16, 2017  3:56 AM

Change a computer’s description

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell

The Win32_OperatingSystem class exposes the machines Description. This is how you can easily change a computer’s description.

PS> Get-CimInstance -ClassName Win32_OperatingSystem | select Description

Description
-----------

PS> Get-CimInstance -ClassName Win32_OperatingSystem |...


July 15, 2017  4:46 AM

Control split output

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

In this post I’ll show you show to control split output – that is control the number of strings that are returned. If you use –split with just a delimiter you’ll get a split occurring at every occurrence of the delimiter:

PS> 'SundayJanuary 01 Jan 1 New Years Day First Monday if...


July 12, 2017  10:13 AM

More diskinfo

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Disk storage, Powershell

Yesterday I showed how to get the disk, partition and logical disk information using CIM. Today I want to show more diskinfo techniques. This time we’ll use the Storage module which was introduced with Windows 8. Underneath the covers it uses CIM – just different classes. The storage module...


July 11, 2017  12:35 PM

Linking disks, partitions and logical drives

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Disk storage, Powershell, WMI

A question of the forums was asking about discovering disk information. They were trying to pipe the output of Get-WmiObject into another Get-WmiObject. that won’t work. There is another way. On Windows machines physical drives are divided into 1 or more partitions which are each divided into one...


July 9, 2017  1:42 PM

Office holidays

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

Office holidays are a great thing. They usually occur on public holidays. There’s a web site - www.officeholidays.com – you can use to discover the public holidays in your country. 133 countries are available - http://www.officeholidays.com/countries/index.php. You can also use PowerShell to...


July 7, 2017  8:03 AM

Variable as a where clause

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

A post on the forum about using a variable as a where clause looked interesting. What the user wanted to do was to define a variable that contained the filter to be used by Where-Object. As an example consider filtering the output of Get-Service to display only services that are...


July 5, 2017  1:39 PM

File name starting with space

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

Interesting question on the forum regarding finding files with a file name starting with a space. First problem was creating some files to match the criteria. Renaming in file explorer didn’t work so back to PowerShell

PS> Rename-Item -Path C:\test\file1.txt -NewName "C:\test\...


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: