Stéphane Thirion
  • Home
  • Consulting – Raidho
  • homelab
3K
0
0
0
Stéphane Thirion
Stéphane Thirion
  • Home
  • Consulting – Raidho
  • homelab
  • Citrix
  • Microsoft
  • Provisioning Services
  • Scripting
  • VMware
  • vSphere
  • Windows 7
  • Windows 8
  • XenApp
  • XenDesktop

Expand virtual machines hard disk – automation

  • March 30, 2016
  • Stephane Thirion
Total
0
Shares
0
0
0
0
0
0
0

Sometimes, at some customers’s place, with an infrastructure already in place (XenApp with PVS or XenDesktop VDI pooled with PVS) the D: drive is too small. The drive where you redirect Windows Event Logs, Logs (UPM for example and/or other applications – services) This is a drive where page file is often redirected as well and even memory dump file generated. PVS cache can also be on this drive :

Cache on device RAM with overflow on Hard Disk

When RAM is zero, the target device write cache is only written to the local disk. When RAM is not zero, the target device write cache is written to RAM first. When RAM is full, the least recently used block of data is written to the local Write Cache disk to accommodate newer data on RAM. The amount of RAM specified is the non-paged kernel memory that the target device consumes.

Cache on device Hard Disk

The cache on local HD is stored in a file on a secondary local hard drive of the device. It gets created as an invisible file in the root folder of the secondary local HD. The cache file size grows, as needed, but never gets larger than the original vDisk, and often not larger than the free space on the original vDisk. It is slower than RAM cache, but faster than Server cache and works in a HA environment.

The lack of space on this drive will bring some slowness in user’s session and this drive needs to be expanded a bit to get back a normal user experience.

To expand these disks two actions need to be done :

  • Expand the Virtual Machine hard disk – in this example vmware Virtual Machines
  • Expand the disk within the Operation System (Windows)

In addition to the following script, psexec tool (Microsoft Sysinternal) is used to execute remotely the diskpart command listed in a text file (diskpart.txt) which is upload to the Virtual Machines. Targeted Virtual Machines need to be powered on. Psexec.exe and Diskpart.txt needs to be in the same folder as the Powershell script, of course you can specify their path as it suits your need.

diskpart.txt   
rescan
select volume 1
extend
exit

 

This script is using XenDesktop / XenApp command to list all the Virtual Machines with SessionSupport value equal to SingleSession, it means the VDI only in my case. If you want to check the lust of Virtual Machines you targeted you can use this command :

List target   
Get-BrokerMachine  -AdminAddress XenDesktopDeliveryControlerAddressFQDN -Filter "((SessionSupport -eq `"SingleSession`"))" -Skip 0 | Select-Object HostedMachineName

If you want to target a specific XenDesktop Delivery Group, then just adapt the previous line :

List VDI Delivery Group   
Get-BrokerMachine  -AdminAddress XenDesktopDeliveryControlerAddressFQDN -Filter "((SessionSupport -eq `"SingleSession`" -and DesktopGroupName -eq `"Name of the Delivery Group`"))" -Skip 0 | Select-Object HostedMachineName

 

Once you know the target, you can execute the following script.

Expand-VMdisk.ps1   
Add-PSSnapin citrix*
Add-PSSnapin vmware*
 
$XDDC = "XDDCFDQN"
$vCenter = "vCenterFQDN"
$NewSizeGB = "12"
 
connect-viserver $vCenter
 
foreach ($list in (Get-BrokerMachine  -AdminAddress $XDDC -Filter "((SessionSupport -eq `"SingleSession`"))" -Skip 0 | Select-Object HostedMachineName)) {
 
get-vm $list.HostedMachineName | get-harddisk | where {$_.name -eq "Disk 1"} | set-harddisk -confirm:$false -capacityGB $NewSizeGB
 copy diskpart.txt $vmc$windowstemp
 psexec $vm diskpart /s C:windowstempdiskpart.txt
 }
 
disconnect-viserver -Confirm:$false

As usual, if you have a better idea ( I’m sure you do ! ) drop me an email, a tweet or comment to share with the community 🙂

Sources :

Understanding Write Cache in Provisioning Services Server

Psexec – Microsoft

Total
0
Shares
Tweet 0
Share 0
Share 0
Share 0
Share 0
Share 0
Share 0
Related Topics
  • automation
  • disk
  • diskpart
  • expand
  • PowerShell
  • PVS
  • scrupt
  • VDI
  • vmware
  • XenApp
  • XenDesktop
Stephane Thirion

Previous Article
  • Citrix
  • Microsoft
  • PowerShell
  • Scripting
  • VDI
  • VMware
  • vSphere
  • Windows 2008 R2
  • Windows 2012R2
  • Windows 7
  • XenApp
  • XenDesktop

XenDesktop XenApp 7.x – vmware / ad / delivery group notes and descriptions sync

  • March 30, 2016
  • Stephane Thirion
View Post
Next Article
  • Citrix
  • Microsoft
  • PowerShell
  • Windows 10
  • Windows 2008
  • Windows 2008 R2
  • Windows 2012
  • Windows 2012R2
  • Windows 2016
  • Windows 7
  • Windows 8
  • XenApp
  • XenDesktop

Remotely clean up Virtual Machines drives – XenDesktop

  • April 4, 2016
  • Stephane Thirion
View Post
You May Also Like
View Post
  • Active Directory
  • ADC
  • Citrix
  • Citrix Virtual Apps and Desktops
  • DaaS
  • Microsoft
  • NetScaler
  • Security

Netscaler native OTP Active Directory account delegation

  • Stephane Thirion
  • March 22, 2023
View Post
  • ADC
  • Citrix
  • NetScaler
  • SDX
  • Uncategorized

Invalid time in the Message sent by the Peer. Please ensure time synchronization between Netscaler and the Peer

  • Stephane Thirion
  • March 3, 2023
View Post
  • ADC
  • Citrix
  • NetScaler
  • SDX

Netscaler SDX LACP on 0/1 and 0/2 (Management Interfaces)

  • Stephane Thirion
  • March 2, 2023
View Post
  • Citrix
  • Citrix Virtual Apps and Desktops
  • Cloud
  • DaaS
  • Microsoft
  • PowerShell
  • VMware
  • vSphere

Create vmware service account for MCS Citrix

  • Stephane Thirion
  • February 28, 2023
View Post
  • Experience
  • Linux
  • VMware
  • vSphere

multipathd errors in /var/log/syslog

  • Stephane Thirion
  • August 2, 2022
View Post
  • Citrix
  • CTP
  • Uncategorized

This is the end of an era

  • Stephane Thirion
  • February 16, 2022
View Post
  • VMware
  • vSphere
  • Windows 2022

Migrating FSMO roles Windows 2022 Server

  • Stephane Thirion
  • January 3, 2022
View Post
  • ADC
  • Experience
  • Linux

Cloud yes but no, thanks (there is some Citrix)

  • Stephane Thirion
  • December 7, 2021
vmware
Binance – Affiliated link
Coinbase – Affiliated link
Blog Stats
  • 1,239,189 hits
Categories
  • Amazon (1)
  • Apple (20)
    • iOS (5)
    • Mac OSx (11)
  • ArchY.net Site (30)
  • Azure (8)
  • Certifications (3)
  • Citrix (211)
    • ADC (4)
    • Citrix Virtual Apps and Desktops (5)
    • DaaS (2)
    • NetScaler (15)
    • Password Manager (3)
    • Personal vDisk (5)
    • Power and Capacity Management (3)
    • Provisioning Services (22)
    • Receiver (29)
    • SDX (2)
    • ShareFile (8)
    • Single Sign On (3)
    • SmartAuditor (2)
    • Storefront (12)
    • Synergy (25)
    • User Profile Management (2)
    • VDI (7)
    • WebInterface (21)
    • XenApp (84)
    • XenApp Plugin (3)
    • XenClient (10)
    • XenDesktop (55)
    • XenServer (42)
  • Cloud (13)
  • Crystal Ball (2)
  • CTP (13)
  • Docker (2)
  • Events (35)
    • E2E – PubForum (9)
    • Geek Speak (3)
  • Experience (53)
  • Kubernetes (2)
  • Licensing (3)
  • Linux (12)
  • Microsoft (147)
    • Active Directory (1)
    • Azure (8)
    • Office365 (4)
    • PowerShell (19)
    • RDS (5)
    • Windows 10 (6)
    • Windows 2003 (21)
    • Windows 2008 (20)
    • Windows 2008 R2 (54)
    • Windows 2012 (13)
    • Windows 2012R2 (13)
    • Windows 2016 (18)
    • Windows 2019 (4)
    • Windows 2022 (1)
    • Windows 7 (27)
    • Windows 8 (19)
    • Windows Virtual Desktop (1)
    • Windows XP (11)
  • News (5)
  • Raidho (2)
  • Raspberry (3)
  • Scripting (13)
  • Security (5)
  • Slide Deck (1)
  • Thin Clients (3)
  • Twitter (1)
  • Ubiquiti (1)
  • Uncategorized (13)
  • VMware (28)
    • VMWare WorkStation (2)
    • vSphere (16)
Stéphane Thirion
Don't Follow the Trend

Input your search keywords and press Enter.