Tags » Powershell-basics

Strings and collections

A question on the forum brought up a point that often confuses PowerShell novices.

QUESTION: What’s the difference between

$computers = ‘W12R2SUS, W12R2DSC’


$computers = ‘W12R2SUS’, ‘W12R2DSC’ 362 more words

Powershell Basics

Controlling copies

I was recently asked about ‘forcing’ a copy so that only the files you want are copied

Consider a folder with lots of files. I want to copy those files that start with the letter t and have a txt extension… 525 more words

Powershell Basics

Updating help problem

A question on the forum posed this question – why does update-help fail on Windows 10 in this case:

£> Update-Help -Module PSDesiredStateConfiguration -Force
Update-Help : Failed to update Help for the module(s) ‘PSDesiredStateConfiguration’ with UI culture(s) {en-GB} : 119 more words

Powershell Basics

Bad habits when creating objects

I’m seeing a lot of code recently that looks like this

$comp = Get-CimInstance -ClassName Win32_ComputerSystem
$os = Get-CimInstance -ClassName Win32_OperatingSystem

$obj = New-Object -TypeName PSObject… 307 more words

Powershell Basics

Creating JSON from a hash table

A question on the forum was asking about creating a JSON structure for use with a REST API.

The original has table looked like this… 512 more words

Powershell Basics

Passing data into Jobs

PowerShell jobs are a powerful tool fro running processes in the background. You have to remember that a PowerShell job runs in a separate process that only exists for the duration of the job. 258 more words

Powershell Basics

Masking output

A question on the forum on how to stop the output from New-Item raises an important point. Many cmdlets produce output when run for example… 204 more words

Powershell Basics