How to Become a Desktop Engineer — Part 10: PowerShell Deep Dive
How to Become a Desktop Engineer — Part 10 of 13
PowerShell Deep Dive
Post 9 gave you the what — packaging and patching, the work that touches every user every week. This is the tenth post in a thirteen-part series on how to become a desktop engineer, and it's the how: PowerShell, the one skill every posting names. McLaren wants engineers who "create and modify PowerShell scripting", StrideCare wants people who can "run, modify, and troubleshoot administrative scripts", Simtra wants PowerShell used "to automate endpoint tasks, app packaging, and deployments" — and Microsoft's own MD-102 exam now has a whole domain for automation through PowerShell and Microsoft Graph.
The working vocabulary
PowerShell reads differently from the command line you already know, and the difference is the whole point. The old command line passes text: one command prints lines, the next parses them with string tricks and hopes the format never changes. PowerShell passes objects. A command returns a thing with properties, and the next command works on those properties directly.
The vocabulary is small and it never changes shape. Every command is a cmdlet, and every cmdlet is named Verb-Noun: Get-Service, Set-Service, Restart-Service, Get-CimInstance. Once you know the verbs — Get, Set, New, Remove, Start, Stop, Test — you can guess a command you have never seen, and Get-Help will confirm the guess.
The pipeline is the second idea, and it is where the power lives. The pipe character | hands the output of one cmdlet to the next, and because what flows is objects, the next cmdlet can filter on real properties instead of text:
Get-Service | Where-Object { $_.Status -eq "Stopped" -and $_.StartType -eq "Automatic" }
That one line answers a question that used to take a spreadsheet: which services should be running and aren't. Read it left to right and it says what it does. No parsing, no guessing, no "it worked on my screen".
The third idea is the one that trips up everyone coming from batch files: you are working with data, not with a screen. Get-CimInstance Win32_LogicalDisk -Filter "DeviceID='C:'" returns a disk object with a FreeSpace property you can compare, sort and export. The same command that prints a table on your screen can write a CSV for the patch meeting, because the table was never the data — it was just one way of looking at it.
Endpoint administration in practice

On one machine, PowerShell is a faster way to do what you already do by hand. Check a service, read a registry key, restart a stuck process — the commands are the same ones you would click through, written down so they can be repeated exactly. Get-ItemProperty reads the registry like a folder. Get-WinEvent reads the logs you learned to read in Part 4.
The job changes when the same command runs against the fleet. Invoke-Command takes a script block and runs it on every machine you name — or every machine in a file — and brings the answers back as one table:
Invoke-Command -ComputerName (Get-Content computers.txt) -ScriptBlock { Get-Service Spooler }
That is the difference between the tiers. Tier 2 asks one machine what is wrong with it. Tier 3 asks five hundred machines the same question and gets one answer. The spooler that is stopped on forty machines is not forty tickets; it is one pattern — a bad driver pushed in last night's update, a policy that stopped the service on one model — and the pattern is usually the fix.
Two habits keep fleet commands safe. First, the CIM cmdlets replaced the old WMI ones: Get-CimInstance is the current way to ask a machine about its disks, its BIOS, its installed software — the old Get-WmiObject is gone from PowerShell 7. Second, never run a changing command on the fleet before you have run it on one machine. -WhatIf exists for exactly this: it tells you what the command would change without changing anything.
Microsoft Graph: the second language
Everything so far runs on a machine. Graph is the same automation aimed at the cloud — Entra ID and Intune, the platforms from Parts 5 and 7. Where PowerShell talks to Windows, Graph talks to the tenant: users, devices, compliance state, policies. Connect once with Connect-MgGraph, and the same verbs work on a different world: list every non-compliant device, find the machines that have not checked in for thirty days, pull a report the Intune console will not give you.
Learn the two languages together, not one after the other. PowerShell answers questions about machines. Graph answers questions about the tenant. The engineer's day needs both, usually in the same script: Graph finds the non-compliant devices, PowerShell remotes into one of them and finds out why. Dairy Farmers lists exactly this in its posting — reports built "using PowerShell, MS Graph, ServiceNow, or Power BI".
Scripts worth keeping

Most scripts you will ever write fall into three shapes, and it is worth learning to recognise them, because each one has different rules.
The one-liner answers a ticket. It runs once, on one machine or a handful, and then it is gone. The stopped-service check above is a one-liner. Keep it in your notes, not in a file — its job is to be typed, not maintained.
The scheduled check runs on a timer and tells you something before a user does. Disk space below ten percent, a certificate expiring in thirty days, a service that keeps stopping overnight. The check does not fix anything; it reports. Its discipline is the log: a check that runs silently and tells nobody is a check that never ran.
The detect-and-remediate fix closes a whole class of tickets instead of one ticket. It has two halves: a detect script that asks "is this true?" and a remediate script that runs only when the answer is yes. Intune runs the pair on a schedule across the fleet. A service that keeps stopping gets restarted wherever it stopped, and the log says where. The test for a good remediation is that it fails safely: if the detect script is wrong, nothing happens; if the remediate script cannot fix it, it says so instead of making it worse.
Whatever the shape, the discipline is the same: test on one machine before the fleet, log what the script did, and keep the script somewhere it can be found again.
Reading other people's scripts
Most of your career starts from a script someone else left behind: a predecessor's logon script, a forum answer copied into production five years ago, a packaging script from Part 9 that nobody remembers writing. Your first job with any inherited script is not to run it. It is to read it.
Read it the way you would read a change request. What does it touch — registry, services, files, the network? What does it assume — that a folder exists, that the user is an admin, that the machine is on the office network? What happens when the assumption is wrong? A script that deletes a folder it expects to exist will delete the wrong folder when it does not, and the author is not there to warn you.
Then run it the safe way: -WhatIf first, then on a test machine, then on a pilot ring — the same rings from Part 9, because a script ships to the fleet at the same speed as a package. Check it into version control before you change it, so the original is never lost, and write a comment at the top saying what it does and when you changed it. The next engineer will do the same for yours.
Practise it this week
- Answer a ticket with one line. Find a real question from your week — a service that should be running, a disk that is nearly full — and answer it with a single pipeline. If the line needs a second line to explain itself, it is not finished yet.
- Ask the fleet a question. Pick ten machines — test VMs, or a pilot group — and run one
Invoke-Commandagainst all of them. Bring the answers back as one table, and find the one machine that disagrees with the other nine. That disagreement is the investigation. - Read a script you did not write. Find one in your environment, or in the PSADT package from Part 9, and read it end to end before running it. List what it touches, what it assumes, and what happens when the assumption is wrong. Then run it with
-WhatIfand compare.
Next up: Automation. PowerShell is the language — now the scripts become systems. Remediation that runs while you sleep, reporting that proves the fleet is healthy, and the judgment call of what to automate and what not to.
Missed the earlier posts? Start with Part 1: What a Desktop Engineer Actually Does, Part 2: The Path, Stage by Stage, Part 3: The Mindset — Curiosity Is a Technical Skill, Part 4: Windows 11 Inside Out, Part 5: Identity: AD, GPO, Entra ID, Conditional Access, Part 6: Networking Essentials, Part 7: Intune + Autopilot, Part 8: SCCM & Co-management, and Part 9: App Packaging & Patching.



















