Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

PowerShell Workflow Bug

Posted on October 31, 2012

There is bug with workflows in PowerShell v3 that you might run into. I kept banging into it until I tracked it down.  The problem occurs if you try to run a workflow from a PSDrive that you have added. For example, I have a PSDrive (S) which is mapped to C:\Scripts. When I try to run a workflow from this drive, I will get an error.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!


PS S:\> get-foo
Cannot perform operation because operation "ResetRunspaceState" is not valid. Remove operation "ResetRunspaceState",
or investigate why it is not valid.
+ CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvalidOperation
+ PSComputerName : [localhost]

The workaround is to simply change to your C: drive, or any PSDrive that PowerShell loads by default. Then the workflow will run.


PS C:\> get-foo
hello

This has been filed on Connect but I thought I'd share the workaround so you don't have to bang your head. And if you are curious about workflows, there will be a good chapter in the forthcoming PowerShell in Depth book.


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d