Category Archives: Powershell

Test if a transcript is running

PowerShell has the ability to create a transcript of the commands you run at the console and the results displayed in the console. But how can you test if a transcript is running? It used to be that you could … Continue reading

Posted in Powershell | 2 Comments

Identifying the host

Identifying the host in which your PowerShell code is running could be important. For instance you might not want to run some code that takes a long time to complete in VSCode – you may prefer to ensure it runs … Continue reading

Posted in Powershell | Leave a comment

PowerShell Day UK 2019

The PowerShell Day UK 2019 one day conference is on Saturday 28 September 2019 – https://psday.uk/ I’ll be speaking and willing to answer any PowerShell questions that I can during the breaks. If you have any books of mine that … Continue reading

Posted in Powershell | Leave a comment

Unblock and unzip

When you download a zip file from the Internet you have to unblock and unzip the file. I need to do this fairly often so wrote this simple function to perform both actions rather than doing it manually. function unzipfile … Continue reading

Posted in Powershell | Leave a comment

Variables in scriptblocks

I often see questions regarding the use of variables in scriptblocks. Usually a variable will be defined outside the scriptblock and then an attempt will be made to use it in the scriptblock: PS> $path = ‘C:\test\OldData01.txt’ PS> Start-Job -Name … Continue reading

Posted in Powershell | Leave a comment

Test local user doesn’t exist before creating

Saw a question asking how to Test local user doesn’t exist before creating.  Windows 8 introduced the LocalAccounts module for Windows PowerShell. On Windows 10 1903 it runs in PowerShell v6/7. There isn’t a Test-Localuser cmdlet but you can attempt … Continue reading

Posted in Powershell | Leave a comment

Missing verbs?

I saw a post that suggested that you can’t use Sort as a verb in your functions. You get a message that sort is an unapproved verb. Are there any other missing verbs? I started with the object cmdlets as … Continue reading

Posted in Powershell | Leave a comment