some of the apps we use have to be reset often so i wanted to write a script so our users can reset their own session instead of having to put in a ticket. what i thought up was a .bat on the users computer that calls a .ps1 on the citrix server that then resets the session. everything works great when the user is given local admin rights on the server, but obviously this is not ideal. so far i have setup a custom account on citrix to allow the users to reset sessions, i have set the local machine ExecutionPolicy to bypass. im not really sure what else could be causing the issue. on the user side i get " AuthorizationManager check failed"

5 Spice ups

Not really sure you have given us much to go on. BUt some thoughts:

  1. Why complicate things running a batch file to then run powerShell? Just set it up as a .PS1 filfe and go from there.

  2. Maybe consider using Windows Forms and create a mini-GUI app which has a button etc?

3, Without seeing the script we can not tell you what to fix. I am led to believe AI technology is in PowerShell v8. :slight_smile: in case of doubt.

4, It sounds like a classic permissions problem/issue. If you make someone admin and things work, but stop working when they are no longer an admin, it’s almost certainly permissions. I am guessing, but it could be that the methods/cmdlets being used require elevated permissions. But without seeing the script it’s hard to know.

its pretty convoluted and i would love a simpler solution but here is what i have now. the .bat on the client computer is a powershell command encoded to base64 to get around the execution policy

powershell.exe -encodedcommand SQBuAHYAbwBrAGUALQBDAG8AbQBtAGEAbgBkACAALQBDAG8AbQBwAHUAdABlAHIATgBhAG0AZQAgACQAcwBlAHIAdgBlAHIAbgBhAG0AZQAgAC0AUwBjAHIAaQBwAHQAQgBsAG8AYwBrACAAewBcAFwAJABzAGUAcgB2AGUAcgBcAGMAJABcAFIAZQBzAGUAdABDAGkAdAByAGkAeABTAGUAcwBzAGkAbwBuAC4AcABzADEAIAAkAHUAcwBpAG4AZwA6AGUAbgB2ADoAYwBvAG0AcAB1AHQA
ZQByAG4AYQBtAGUAfQA=

here is the unencoded version:

Invoke-Command -ComputerName $servername -ScriptBlock {\\$server\c$\ResetCitrixSession.ps1 $using:env:computername}

here is the script it calls on the citrix server:

Param([Parameter(Mandatory=$true)][string]$computername)
add-pssnapin Citrix.*
$session = get-xasession | where{$_.clientname -like $computername} | stop-xasession

i agree with your statement that its a permission problem but I’ve already given access to everything i can think of.

They need permissions on Citrix and winrm/ remote PowerShell permissions. By default only admins will have remote PowerShell permissions. I’ve never done it but you can configure remote PowerShell. Try https://4sysops.com/archives/powershell-remoting-without-administrator-rights/. As an alternate you may be able to install the Citrix PowerShell modules on the client itself. I don’t know, but it’s something to look into. My Citrix cmdlets have an -adminaddress parameter or something like that and I believe they use http/https rather than winrm.

1 Spice up