Monthly Archives: February 2019

PowerShell interviews

Following my last post about sample questions for PowerShell interviews that I’d stumbled across I’ve been asked what sort of questions I’d ask – given my statement that many of the question sets were out of date. I’ve thought about … Continue reading

Posted in Powershell | Leave a comment

PowerShell interview questions

For some bizarre reason I ended up looking at various sets of PowerShell interview questions and answers. For the most part they scared me – due to their outdated nature. Many, if not most,  of  the question sets hadn’t been … Continue reading

Posted in Powershell | 1 Comment

Execution policy

PowerShell gives you a number of options regarding execution policy. You use one of the following options with Set-Execution policy: Restricted – won’t run scripts or profiles. This is the default execution policy Allsigned – only scripts (and profiles) signed … Continue reading

Posted in Powershell | 1 Comment

Processing files with switch

The switch statement has a –file parameter that can be used to give the path to a file. The file is read one line at a time and processed through the switch statement. The example from last time can be … Continue reading

Posted in Powershell | 1 Comment

Splitting a file

Saw a question about splitting a file that had repeating data blocks.  Each block starts with HOST so the code to split becomes: $fnum = 1 Get-Content -Path C:\test\Data.txt | ForEach-Object -Process {   if ($_ -like ‘HOST*’) {      $file = … Continue reading

Posted in Powershell | Leave a comment

PowerShell operators

PowerShell has operators – lots of operators. This is a quick overview of the PowerShell Operators. The obvious place to start is the arithmetic operators –  see about_Arithmetic_Operators +, –, *, / perform the four arithmetic operations % is for … Continue reading

Posted in Powershell | Leave a comment

Summing multiples

Came across the project Euler web site – https://projecteuler.net. It has literally hundreds of problems – mainly mathematical – that’ll illustrate some useful PowerShell techniques. The first problem is summing multiples. You need to sum all of the multiples of … Continue reading

Posted in Powershell | 1 Comment