Invoke-AsCurrentUser_WithArgs

1.0.0

Execute PowerShell scriptblocks in the context of the currently logged-in user from a SYSTEM context. Ideal for Intune deployments, SCCM task sequences, and scheduled tasks.

Minimum PowerShell version

5.1

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name Invoke-AsCurrentUser_WithArgs

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name Invoke-AsCurrentUser_WithArgs

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

(c) 2025. All rights reserved.

Package Details

Author(s)

  • Harze2k

Tags

RunAsUser Intune SCCM SYSTEM UserContext Deployment Windows

Functions

Invoke-AsCurrentUser_WithArgs Serialize-Object Deserialize-Object Get-RunAsUserCSharpSource

PSEditions

Desktop Core

Dependencies

This module has no dependencies.

Release Notes

## Version 1.0.0
- Initial release
- Execute scriptblocks as currently logged-in user
- Pass arguments/variables to scriptblocks
- Capture transcript and execution results
- Support for PowerShell 5.1 and 7+
- Configurable timeout handling
- Optional stream capture (stdout/stderr)

FileList

Version History

Version Downloads Last updated
1.0.0 (current version) 496 12/1/2025