Skip to content

Commit

Permalink
chore: Refactor Win_RunAsUser_Example.ps1 to simplify CaptureOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
silversword411 committed Jul 17, 2024
1 parent c6a8e1b commit b81e750
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/Win_RunAsUser_Example.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If (!(Test-Path "c:\ProgramData\TacticalRMM\temp\")) {

Write-Output "Hello from Systemland"

Invoke-AsCurrentUser -CaptureOutput -ScriptBlock {
Invoke-AsCurrentUser -ScriptBlock {
# Put all Userland code here
$exit1Path = "c:\ProgramData\TacticalRMM\temp\exit1.txt"

Expand All @@ -41,7 +41,7 @@ Invoke-AsCurrentUser -CaptureOutput -ScriptBlock {
# Writing exit1.txt for Userland Exit 1 passing to Systemland for returning to Tactical
Write-Output "Exit 1" | Out-File -append -FilePath $exit1Path
}
}
} -CaptureOutput

# Checking for Userland Exit 1
If (Test-Path -Path "c:\ProgramData\TacticalRMM\temp\exit1.txt" -PathType Leaf) {
Expand Down

0 comments on commit b81e750

Please sign in to comment.