A user had troubles with a script for taking a machine out of maintenance mode in cloud-managed Citrix DaaS. It was suggested to check the parameters and to compare the script for enabling maintenance mode. The issue was solved by installing the Citrix SDK, saving credentials to a secureclient.csv file, and including the Set-XDCredentials command in the Disable script. It was recommended to update the scripts for the Cloud environment.
Read the entire ‘Troubleshooting a Script to Disable Maintenance Mode in Cloud-Managed Citrix DaaS’ thread below:
Anyone have a working script to take a machine out of maintenance mode that works in solve for cloud managed citrix Daas? I have one working for “enable” mm but having trouble getting the “disable” to work properly
I don’t have a script lying around, but what is the nature of the problem?
says it cant find the machine
all i did was edit the one I had to Enable MMthis one works.Odd, would not know top of my head what the reason is. I compared the Enable and Disable scripts we have, the only difference is literally the -InMaintenanceMode $true vs $false and the text for the output.
As a double check, try the original Disable XenDesktop Maintenance Mode script, just in case?
These scripts have been around a long time, it seems the command Get-BrokerSharedDesktop is deprecated: https://developer-docs.citrix.com/projects/citrix-virtual-apps-desktops-sdk/en/latest/Broker/Get-BrokerSharedDesktop/
That does not explain why it would work for Enabling maintenance mode but not for Disabling it though.
yeah i had to change it to BrokerPrivateDesktop
maybe i need to change it to BrokerDesktop.THere is still this line that uses a deprecated command as well though:
$TargetMachine = Get-BrokerSharedDesktop "*\$machineName"
Line 21.
SHouldn’t that be Get-BrokerPrivateDesktop as well then?
but yeah all i did was change $true to $false.
I have not looked at these commands for a long time, but if it is VDI I suspect you may need Get-BrokerPrivateDesktop instead of shared, just from the name.
It could be a quirk that Get-BrokerSharedDesktop works for a machine that is not in maintenance but not for a machine IN maintenance.
Are you erroring out on line 21: Unable to determine desktop status – possibly insufficient administrative privileges
Or does it happen later, and what is the exact error message?
yes which is so odd because it works in the
enable" script. Let me check my parameters in controluphere is enable
Yeah, looks fine.
AHA!
There is no argument specified for the Disable script. That would casue the problme!man its nice to have someone to bounce stuff off of. thank you sirIt’s a tad later here, got my logic the wrong way around 🙂
Yes, the machine is not found at all. That is why it gets to line 40.
Removing the old comments. Not because I’m hiding I messed up, but I don’t want to confuse anybody else coming across this thread and not reading the conclusion.
Whoops?
😁
Glad to help Chris, even if I got my logic backwards at first.so for anyone interested here’s the Disable Maintenance Mode for cloud-managed CVAD. I got it to work by installing the Citrix SDK on the ControlUp broker machines and console machines. I saved my credential information to login in the file secureclient.csv
You’d obviously have to change this line with your information and have the .CSV file on each server that may run the script (ControlUp console servers, or monitors if you want to make it an automated action) : Set-XDCredentials -CustomerId [ENTER YOUR ID] -SecureClientFile "[ENTER YOUR PATH]\secureclient.csv" -ProfileType CloudApi -StoreAs "CloudAdmin"I had to include the Set-XDCredentials in the script because for some reason the Get-XDCredentials stopped working after a while. So I just set it and get it each time the script runs. Kinda dumb. It should work just pointing to the Profile NameThe original versions of these scripts were not written with Cloud in mind
I will ask @member to take a look at these two scripts to bring them up to date. He wrote the https://www.controlup.com/script-library-posts/manipulate-citrix-virtual-apps-and-desktops-tags/ script as well, that also can put machines in and out of maintenance.
Continue reading and comment on the thread ‘Troubleshooting a Script to Disable Maintenance Mode in Cloud-Managed Citrix DaaS’. Not a member? Join Here!
Categories: All Archives, ControlUp Scripts & Triggers