Thursday 2 May 2024

Install Vmware Powershell Snap Ins

 You should be able to grab the VMware powershell snap-ins download from the Vmware site. 


These are just a bunch of files. 

run $env:psmodulepath to see a list of paths you can place the modules. 


Typically i use 
C:\Windows\system32\WindowsPowerShell\v1.0\Modules


Then copy these on the machine you want to run CLI into the folder. 

the import the modules required

Import-Module VMware.VimAutomation.Core










Tuesday 6 February 2024

Citrix Information available in Session (NameSpace)

 




We can use Namespace Info to get some information on a VM

This can be handy for getting some awareness within windows. 



gwmi -Namespace root\citrix\desktopinformation -class Citrix_VirtualDesktopInfo


  • This will shows
  • Site Name
  • Catalog Name
  • Delivery Group Name

Wednesday 31 January 2024

Windows Server loses Domain Trust - Aka falls out Domain - Repair it with script from ControlUp

 I have often seen server and workstations fall out of the domain.

Detecting this is hard and i will post back if i find something. 


But fixing can either be done manually or via script. 


I see Controlup providied a script. 

Shame is i dont think you will be about to remote execute it due to the nature of the issue.


Anyway check out the script

https://www.controlup.com/script-library-posts/repair-machine-domain-trust-relationship/



Wednesday 20 December 2023

Citrix Release Years

 After preparing for an interview i was thinking about how long i have been working on Citrix products. 

So to be sure i asked ChatGPT for release years. It didnt do a very good job, so heres a tidy list.

the short answer though for me is 20+ years oif experience.



Citrix Metaframe XP  - Released 2002

Presentation Server - Released 2005

XenApp 6 -  Released 2010

XenApp 6.5  - Released 2012

Xendesktop  - Released 2013

CVAD - Released 2018


Friday 18 November 2022

Powershell Sleep with GUI feedback - Powershell Sleep Feedback timer

 We often need pauses or sleep in our powershell scripts. 

However it can be annoying not to know where the sleep or pause is at. 

The following function gives a visual GUI feedback of the sleep in the script


Example here  (30 seconds remaining)



To acheive this add this function to your script, and call it with the command

sleep-progress 30      



Function Sleep-Progress($seconds) {
$s = 0;
Do {
$p = [math]::Round(100 - (($seconds - $s) / $seconds * 100));
Write-Progress -Activity "Waiting..." -Status "$p% Complete:" -SecondsRemaining ($seconds - $s) -PercentComplete $p;
[System.Threading.Thread]::Sleep(1000)
$s++;
}
While($s -lt $seconds);

}

PowerShell window pauses running code due to focus change

 PowerShell window pauses due to focus change - This is very annoying if your running log scripts on your daily machine , as you want to minimise powershell and expect it to crack on, but it often pauses and needs you to hit a key for it to continue. 

you almost get dragged back to the 1980s  "Press any key to continue" memorys

How to resolve it

Remove " Quickedit Mode" 

Remove "Insert Mode"

I know these are very handy features to have on. BUT these need to be disabled to make the window reliable. 







Friday 9 September 2022

 Rebuild WMI 

We have sometimes found the WMI classes are blank or corrupt.


The following steps can rebuild your WMI


Disable and stop WinMgmt service

rename C:\windows\system32\wbem\repository

Enable the WinMgmt Service

change path to c:\windows\system32\wbem

run for /f %s in ('dir /b *.mof) do mofcomp %s

run for /f %s in ('dir /b en-us\*.mfl') do mofcomp en-us\%s




Monday 25 March 2019

Xendesktop power State unknown - Vmware Xendesktop UUID GUI Mismatch

A POWER STATE UNKNOWN is quite likely to be produced in the event of change to VMs on the hyper-visor that breaks its connection with Xendesktop. This commonly occurs with a VM GUID change.

You need to ensure that the Xendesktop GUID for VMs matches the Hyper-V or Vmware GUID.


Vmware Command to View Hosted Connection GUID
$Data = get-vm $Machinename | get-view
$DataConfig = $data.vmware.vim.virtualmachineconfiginfo
$GUID = $DataConfig.Config.uuid


Vmware View GUIDs on Host Machine
get-childitem -path xdhyp:\hostingunits\hostservername -recurse | select -property name,id | Export-csv C:\host.csv

Xendesktop view GUID
Get-brokermachine -machinename uk\machinename | select Name,Hostedmachineid


If they are out sync, then you will need to set the GUID In Xendesktop to match the hypervisor with the following command

set-brokermachine -machinename domain\computername  -hostedmachineid xxx-yyyy-zzzz


Note : If the command to get the ID from Vmware fails, it can also be gained by changing directory to cd XDHYP:\connections\hypervisorname  then dir *.vm >out.txt and check inside the output for the machines ID









Tuesday 19 March 2019

Batch File Loop X times

Run a Batch command X times

This will loop 100 times. Start at 1, count in 1's until you get to 100.

for /l %%x in (1, 1, 100) do (
do this
do that
)

Wednesday 13 March 2019

Citrix Xendesktop LHC v Connection Leasing - Xendesktop 7.15 Upgrades

Local Host Cache

XA 7.9 onwards support Local host Cache Mode. This is an improvement over connection leasing. However only new installs perform the switch over. 

To disable connection leasing and enable LHC perform the following command on a controller In each site. 

Set-BrokerSite -LocalHostCacheEnabled $true -ConnectionLeasingEnabled $false