Archive for the ‘Uncategorized’ Category

Citrix XenDesktop Power State Off but Registration displays Registered

Monday, June 12th, 2017

User was having issue accessing her virtual desktop. She was getting the spinning as if the machine was trying to be powered on when attempting to launch her Enterprise Static Desktop and eventually it would fail and Citrix Director was reporting timeout. I attempted the normal restart of machine and also forced reset in VMware with no success. Upon further diagnosis noted her machine was reporting that the Power State was OFF in the Citrix Studio console and yet the Registration Status was stating Registered (normally if Power State is OFF machine will be Unregistered). So upon further investigation I found the virtual machine was actually ON within VMWare host so the Power State in Citrix Studio was being incorrectly reported.

It appears something with HostMachineID wasn’t correctly updated in the SQL database, I validated this by running a few commands and then ultimately updating SQL database with correct HostMachineID. I’m providing this information in the event this happens again, I’m not sure what the root cause is other than possibly the database was synchronizing when the outage occurred Saturday night and failed back over with incorrect machineID when she attempted a connection.

Below are the steps, if there is any question if this is the issue please validate before running the final command as this can cause serious issues to other virtual desktops if wrong Ids are updated in database

1. Within Citrix Studio launch PowerShell Console and run following command:

asnp Citrix*
Get-ChildItem -Path XdHyp:\ -force -recurse | ?{ $_.IsMachine } | Out-File –Filepath c:\xdhyp.txt

2. This will give you output to c:\xdhyp.txt, review the txt and do a Find for the machine in question in our circumstance it was LABVSM007, what we are specifically looking for is the Id I’ve highlighted in yellow below. Please record this information once you’ve validated the correct Name of machine.

PSPath : Citrix.Host.Admin.V2\Citrix.Hypervisor::XDHyp:\Connections\labesx\datacenter\VDI.cluster\labvsm007.vm
PSParentPath : Citrix.Host.Admin.V2\Citrix.Hypervisor::XDHyp:\Connections\labesx\datacenter\VDI.cluster
PSChildName : labvsm007.vm
PSDrive : XDHyp
PSProvider : Citrix.Host.Admin.V2\Citrix.Hypervisor
PSIsContainer : True
AdditionalData : {[PowerState, PoweredOn], [MachineAddress,]}
FullName : labvsm007.vm
FullPath : XDHyp:\Connections\labesx\datacenter\VDI.cluster\bosvsm007.vm
Id : 4be83442-2367-690e-06ea-2543bab2afce
IsContainer : True
IsMachine : True
IsSnapshotable : True
IsSymLink : False
Name : labvsm007
ObjectPath : /datacenter/VDI.cluster/labvsm007.vm
ObjectType : Vm
ObjectTypeName : vm

3. Now we will need to run another PowerShell command to find machines with specific Power State. In our circumstance where BOSVSM007 was reporting with a Power State OFF we’ll run the following command:

Get-BrokerMachine -PowerState Off | Out-File –Filepath C:\broker-state-off.txt

4. The output of this file will list all the machines that are currently in a state of OFF, were again looking for specific machine BOSVSM007 so perform a Find and you’ll see an example that looks like below. You’ll notice the HostedMachineId (4234e84b-6723-0e69-06ea-2543bab2afce) doesn’t match the Id (4be83442-2367-690e-06ea-2543bab2afce) from our earlier output above, and this is where the issue is and we need to correct this within database by running command in our next step.
gentVersion :
AllocationType : Static
ApplicationsInUse : {}
AssignedClientName :
AssignedIPAddress :
AssignedUserSIDs : {S-1-5-21-2825674128-16851514-2748543733-2108}
AssociatedTenantId :
AssociatedUserFullNames : {Lastname, Firstname}
AssociatedUserNames : {LAB\user01}
AssociatedUserSIDs : {S-1-5-31-2825674128-16851514-2748543733-2108}
AssociatedUserUPNs : {user01@lab.local}
BrowserName : Enterprise Static Desktops $P122
Capabilities : {CBP1_5, ReRegisterNow, PvdProgress, LeasedConnection…}
CatalogName : MC-XenDesktop-Static-Manual-Desktops
CatalogUUID : 87d78bbd-0ea1-4268-bfd3-91701d7724d9
CatalogUid : 5
CbpVersion : v1_5
ColorDepth :
ControllerDNSName : deliverycontroller01.lab.local
DNSName : LABVSM007.lab.local
DeliveryType : DesktopsOnly
Description :
DesktopConditions : {}
DesktopGroupName : Enterprise Static Desktops
DesktopGroupUUID : ff0618ec-d605-41ed-a1aa-a016d2227df6
DesktopGroupUid : 5
DesktopKind : Private
DesktopUid : 122
FaultState : None
FunctionalLevel : L7_9
HostedMachineId : 4234e84b-6723-0e69-06ea-2543bab2afce
HostedMachineName : labvsm007
HostingServerName : labesx.lab.local
HypHypervisorConnectionUid : 120919fe-7e98-47bd-b8e2-8600d516207f

5. In this step we’ll update the Citrix SQL database with correct HostedMachineId from our Step 1 output (Please double check all previous output to assure you have correct IDs in question and assure you’ve recorded all previous IDs in question in the event you need to revert changes).

Set-BrokerMachine -MachineName ‘LAB\LABVSM007’ -HostedMachineId 4be83442-2367-690e-06ea-2543bab2afce

6. Now we need to go to VMware https://labesx.lab.local/vsphere-client/ and shutdown the machine in question LABVSM007 and go back to Citrix Studio console and click on the machine and choose Start. It should successfully start machine and upon choosing refresh in console you should now see Power State ON and shortly after the Registration to Registered.

7. Please have end-user validate they can connect to their Enterprise Static Desktop once the Registration changes to Registered.

Get Users of a AD Group

Monday, June 12th, 2017

dsquery group domainroot -name ADGroupName | dsget group -members | dsget user -samid > c:\ADGroupName-Members-samid.txt

SCCM Application Deployment – How to make a Program deployment available after specific time and deploy at specified time

Monday, May 9th, 2016

SCCM Application Deployment

How to make a Program deployment available after specific time and deploy at specified time.

  • Create Adhoc Collection (Do not assign specific maintenance window)
  • Right click “Your Collection Name” > Deploy a Program
  • When Deploy Software Wizard appears, validate Collection: and click Browse under Software: choose the software you’d like to deploy and click Next >
  • Validate the Distribution point \\ click Next >
  • Under Purpose choose “Required” click Next >
  • You’ll now be presented with “Specify the schedule for this deployment”
    • Check the first option “Schedule when this deployment will become available:” (choose a time you want the package to be available on the endpoint e.g. Saturday at 3PM
    • Leave the second checkbox unchecked
    • Under Assignment Schedule click “New” and you will be presented with Assignment Schedule window. Click Schedule and within the Custom Schedule window choose a start time e.g. Saturday at 8PM and on recurrence schedule choose “None” and click OK
    • You’ll be back at the “Specify the schedule for this deployment” on Rerun behavior: choose “Rerun if failed previous attempt” click Next >
  • Within the Specify the user experience for the installation of this software on the selected devices window select “When the scheduled assignment time is reached, allow the following activities to be performed outside of the maintenance window” check Software installation.
  • On next window for both dropdowns choose “Download content from the distribution point and run locally” leave “Allow clients to share content with other clients on the same subnet” checked. Click Next >
  • On the Confirm the settings window. Carefully review all settings and assure everything is configured as specified and the time and date are accurate and when ready click Next >

Nesting Hyper-V 2012 R2 on VMware ESXi 5.5

Wednesday, August 12th, 2015

Rename part of file name

Friday, July 24th, 2015

Remove character from filename

The below script finds “$” within the filename and removes it while leaving the file extension intact.

Get-Item * | ForEach-Object { rename-item $_ ($_.Name -replace ‘\$’, ”) }

For our use we had a bunch of dos Professional Write files that had random file extensions that needed to be merged with file name for example test.hello. So the script below looks for “.” and removes the period so essentially the new file name becomes testhello. Notice the different between the powershell script above and below. This does not contain .Name and the characther its searching for is “.” instead of “$”

Get-Item * | ForEach-Object { rename-item $_ ($_ -replace ‘\.’, ”) }