Automating with PowerShell?

PowerShell scripts refusing to run across machines? We unstick it.

PowerShell gets inherited more than it gets written. A script that worked for the engineer who left, a module that only installs with the right trust setting, a scheduled task running under a service account that cannot reach the share. We go through execution policy, signing, module paths and credential storage until the script runs the same on every box in your estate.

  • Since 2015Fixing technology
  • FreeEstimates
  • US teamReal engineers

pwsh-transcript.log

still broken

What it is

PowerShell at a glance

PowerShell began as Windows PowerShell, built on the .NET Framework and shipped with Windows as a replacement for cmd.exe and VBScript. In 2016 Microsoft forked the project as PowerShell Core, open sourced it, and re-based it on .NET Core so it could run on Linux and macOS as well as Windows. The current line is simply called PowerShell and has reached version 7.

The language combines a shell pipeline with a .NET object model. Cmdlets are discoverable, structured output flows from one command to the next, and modules bring in everything from Azure management to Active Directory. It is used heavily for Windows server administration, cloud automation, SCCM and Intune management, and cross platform CI pipelines where a scripting layer has to reach .NET.

Type
Object pipeline shell and scripting language
First released
2006 as Windows PowerShell, 2016 as cross platform PowerShell Core
License
MIT for PowerShell 7 and later, open source
Maintained by
Microsoft and community contributors
Typically used for
Windows admin, Azure automation, DevOps pipelines, scheduled jobs across servers

The honest version

PowerShell pros and cons

No technology is all upside. This is where PowerShell earns its place and where it tends to cause trouble.

Where PowerShell is strong

  • Objects move through the pipeline, not stringsGet-Process piped to Where-Object operates on .NET objects with typed properties. No awk, cut and tr to parse text that was never meant to be parsed.
  • Deep integration with Windows and Microsoft 365Active Directory, Exchange, Intune, Azure, SharePoint and SCCM all ship cmdlet libraries. Anything the GUI can do, PowerShell can usually script better.
  • Cross platform since PowerShell 7The same script runs on Windows Server, Ubuntu and macOS. CI pipelines and infrastructure code can use one scripting layer across the fleet.
  • Discoverable languageGet-Command, Get-Help and Get-Member together make it a reasonable learning path even for engineers who have never touched .NET.
  • Approved verb noun grammarCmdlets follow a predictable pattern. Once you learn Get-, Set-, New- and Remove-, most of a module's surface reads itself.

Where PowerShell bites

  • Execution policy trips every new machineRestricted and AllSigned defaults stop scripts the first time they are copied. Teams hit it, bypass it the wrong way, and leave a security hole in exchange.
  • The two version split still bitesWindows PowerShell 5.1 ships with Windows and will not go away. PowerShell 7 is separate. Modules behave slightly differently on each, and some are only on one.
  • Type coercion is loose in places you do not expectA string that looks like a number sometimes gets coerced, sometimes does not. Bugs arrive at the boundary between PowerShell data and strict .NET methods.
  • Module management is better than it was, not perfectPSGallery is reliable; nuget feeds, air gapped mirrors, and the move from PowerShellGet v2 to v3 have left plenty of installs in odd states.
  • Error handling is inconsistentNon terminating errors, terminating errors and $ErrorActionPreference interact in ways that trip engineers used to try, catch in languages where every error is caught.
  • Scheduled task and job runners are their own worldA script that works in an interactive session can quietly fail at 3am because of a service account, a profile path, or a quoting difference in the task XML.

Sound familiar?

Common PowerShell problems we fix

The PowerShell problems that bring people to us, and what you have once each one is fixed.

running scripts is disabled on this system

Execution policy is blocking the script

A fresh machine on Restricted, a script downloaded from the internet with the zone identifier still attached, or a Group Policy overriding whatever the user sets. We sort the policy, the signing and the Unblock-File step together.

Script runs on every target machine

Install-Module: No match was found

A required module will not install

A PSGallery trust prompt that was never answered, an air gapped server without the package source, or a TLS 1.2 handshake missing on an older Windows image. Each one has a different fix.

Modules installing cleanly

Cannot convert value "System.String" to type "System.Int32"

A parameter is being passed as the wrong type

Input from Read-Host, a CSV import, or a pipeline upstream that emits a string where an integer was expected. The cmdlet refuses, and the error points at the wrong part of the chain.

Types pinned at the boundary

Register-ScheduledJob: task XML incorrectly formatted

Scheduled jobs are failing to register or run

An argument list with unescaped quotes, a service account without 'Log on as a batch job' rights, or a profile that never loaded for the task user. Jobs miss, and the error does not reach anyone.

Scheduled jobs reliable and monitored

AuthorizationManager check failed

Signed scripts are failing on other machines

A code signing certificate trusted on the author's box but not in the target machine store, or a chain that lost its intermediate certificate. Trust store and signing both need attention.

Script signatures validate everywhere

The term 'Connect-AzAccount' is not recognized

A cmdlet works on one machine and not on another

Az module installed for the user, not the machine, or installed for Windows PowerShell 5.1 but the script runs under PowerShell 7. Module scope and version mismatches explain most of this family.

Modules available where the script runs

Access to the path 'C:\Windows\System32\config' is denied

Privilege is missing in the session

A console that was not elevated, or a remote session that runs as the connecting user rather than an admin. We either raise privilege cleanly or redesign the script to not need it.

Script runs with the right privilege

What we do

PowerShell help, from one broken script to the full estate

Call us for a single failing scheduled job, or let us take the whole automation layer.

Rescue
A script that runs on one machine and not the next, a module that will not install, or a scheduled task that misses overnight. We trace it, fix it, and record what changed.
Windows PowerShell 5.1 to PowerShell 7 migration
Codebase audit, module compatibility check, and a staged migration that keeps 5.1 dependent paths running until the last one is cleared.
Signing and execution policy
Code signing certificates, Group Policy that fits your fleet, and script publishing that does not put your team in the habit of bypassing security.
Azure and Microsoft 365 automation
Az, Microsoft.Graph and Exchange Online scripts written against current modules, with service principals and managed identities instead of stored passwords.
Scheduled job hardening
Task Scheduler and Azure Automation jobs with transcripts, error channels and alerting, so a 3am failure is visible by 7.
Managed Tech
A standing agreement covering module upgrades, script review, scheduled job monitoring and a PowerShell engineer reachable when the overnight runs quietly stop.

How it works

From first message to fixed

  1. Look Free estimate

    Tell us what's going wrong. We look at it, then tell you plainly what's wrong and what it will cost.

  2. Fix

    We fix the cause, not the symptom. If something is down, getting it back up comes first.

  3. Harden

    Backups, monitoring, updates and access, so the same problem can't quietly come back.

  4. Hand back or stay on

    You get a plain-language write-up. Or we stay on for hosting, upkeep and new work.

Often found together

Running PowerShell alongside something else?

We work on the whole stack, so the problem can be wherever it actually is.

Questions

PowerShell questions

Something else? Call+1 737 727 7327

Why does our PowerShell script work on one machine and fail on another?

Usually a difference in PowerShell version, module scope, execution policy, or user profile. Windows PowerShell 5.1 and PowerShell 7 are separate installs with separate module paths. A script signed with a certificate trusted on the author's machine may not be trusted on a locked down server. We check each layer rather than guessing.

Should we move from Windows PowerShell 5.1 to PowerShell 7?

For most workloads, yes. PowerShell 7 is cross platform, actively developed and compatible with the majority of common modules. Some older modules, particularly those tied to Windows PowerShell internals, still need 5.1. We audit the module list and tell you what blocks a full move.

How do we handle credentials safely in PowerShell?

Avoid plain text in scripts. Use the SecretManagement module for secrets at rest, managed identities for Azure, and Group Managed Service Accounts for scheduled jobs on Windows. We can set each of those up and remove the stored passwords that are already in your tree.

Can you help with Azure Automation and runbooks?

Yes. We write and clean up runbooks in Azure Automation, wire them to Logic Apps or Event Grid where they need triggers, and move scheduled on premise jobs into Automation when the economics make sense.

Our scheduled task runs fine interactively but fails at 3am. What is going on?

Usually the service account cannot reach a share, a profile the script depended on never loads for the task user, or quoting in the task XML corrupts the argument list. Transcripts and a wrapper script that logs its environment are the fastest way to see which one.

How much does PowerShell help cost?

Estimates come with no charge attached. Send over the script, the error or a description of the scheduled job and we come back with a figure before any work is booked.

Free estimate

PowerShell giving you trouble?

Tell us what you're running and what's going wrong. A person reads it and comes back with an estimate.

  • No charge to find out what it will take
  • If it's urgent, say so

Replies come from a person. By sending, you authorize us to email you back. No marketing.