mario
New Member
Posts: 15
|
Post by mario on Jan 14, 2019 11:47:16 GMT
Hello. i use UI++ now for my W10 upgrade task sequences as well The "Preeflight" check is great for that! Is there a WMI query with which I can determine the free space on the system partition ? Greetings, Mario
|
|
|
Post by Jason on Jan 16, 2019 1:31:06 GMT
Adding these two lines after a DefaultValues action where OS is specified as a ValueType will place the free space (in GB) in the variable YSystemDiskFreeSpaceGB:
<Action Type="WMIRead" Namespace="root\cimv2" Class="Win32_LogicalDisk" Property="FreeSpace" KeyQualifier="DeviceID='%XOSSystemDrive%'" Variable="YSystemDiskFreeSpaceBytes"/> <Action Type="TSVar" Name="YSystemDiskFreeSpaceGB">Round(%YSystemDiskFreeSpaceBytes% / 1024 / 1024 / 1024, 2)</Action>
From there, you can add a preflight check like the following:
<Check Text="30GB System Disk Free Space" CheckCondition='%YSystemDiskFreeSpaceGB% > 30' Description="Only systems with at least 30GB of free space can be upgraded to Windows 10." ErrorDescription="This system only has %YSystemDiskFreeSpaceGB%GB of free space and thus cannot be upgraded to Windows 10."/>
I will be adding a built-in DefaultValues variable for system disk free space in the next version so that will eliminate the need for the first two lines in the future.
|
|
mario
New Member
Posts: 15
|
Post by mario on Jan 16, 2019 12:24:24 GMT
thx Jason,
it works when i set CheckCondition='%YSystemDiskFreeSpaceGB% with " like CheckCondition='"%YSystemDiskFreeSpaceGB%"
|
|
|
Post by Jason on Jan 16, 2019 19:41:23 GMT
Sorry, I don't quite understand your reply.
Single quotes or double-quotes are valid for XML attributes so either should work. For conditions, I often use single quotes because these conditions themselves include double-quotes.
|
|
mario
New Member
Posts: 15
|
Post by mario on Jan 17, 2019 6:47:06 GMT
Hi Jason, thats how it works <Check Text="30GB System Disk Free Space" CheckCondition='"%YSystemDiskFreeSpaceGB%" > 30' ErrorDescription="This system only has %YSystemDiskFreeSpaceGB%GB of free space and thus cannot be upgraded to Windows 10."/>
So it does not work <Check Text="30GB System Disk Free Space" CheckCondition='%YSystemDiskFreeSpaceGB% > 30' ErrorDescription="This system only has %YSystemDiskFreeSpaceGB%GB of free space and thus cannot be upgraded to Windows 10."/>
|
|
|
Post by Jason on Jan 18, 2019 1:40:13 GMT
Sorry, not sure what you are doing wrong, but copied exactly as I posted above works in my testing. Without seeing your log, I can't guess what's different but there is no need for the double-quotes around %YSystemDiskFreeSpaceGB%.
|
|
adamp
New Member
Posts: 10
|
Post by adamp on Feb 8, 2019 1:16:19 GMT
Any way to work with percentage of disk, instead of size? This would perhaps change which task sequence they run. Have 1 with usmt to the local drive, then if over 50% of disk used it would use task seq with server storage for usmt.
|
|
|
Post by Jason on Feb 13, 2019 1:41:51 GMT
Sure, just use another TSVar action to gather the total space from Win32_Logical Disk and then in the check simply divide the free space by the total space and compare that to whatever percentage you desire.
|
|
cc
New Member
Posts: 10
|
Post by cc on Oct 17, 2019 20:25:29 GMT
Great thread helped me add the Disk Check to my Prefilght/AD Auth config .
Here is my final config in case it can help anyone.
<UIpp Title="Win10 Upgrade" Icon="windows_10.ico" Color="#3366ff"> <Actions> <Action Type="UserAuth" Title="User Authentication" Domain="domain.com" Group="Upgrade Admins" GetGroups="True" ShowBack="True"> <Field Name="Domain" ReadOnly="True" /> </Action> <Action Type="Info" Name="myInfo" Title="Welcome %XAuthenticatedUser%"> <![CDATA[Select the Check Mark below to continue with the Upgrade<br>]]> </Action> <Action Type="DefaultValues" ValueTypes="All" ShowProgress="True"> </Action> <Action Type="WMIRead" Namespace="root\cimv2" Class="Win32_LogicalDisk" Property="FreeSpace" KeyQualifier="DeviceID='%XOSSystemDrive%'" Variable="YSystemDiskFreeSpaceBytes"/> <Action Type="TSVar" Name="YSystemDiskFreeSpaceGB">Round(%YSystemDiskFreeSpaceBytes% / 1024 / 1024 / 1024, 2) </Action> <Action Type="Preflight" Title="Preflight checks" ShowBack="True"> <Check Text="WLAN Disconnected" CheckCondition='"%XWLANDisconnected%" = "True"' ErrorDescription="Only systems physically connected to the LAN can be upgraded to Windows 10." /> <Check Text="Not on battery" CheckCondition='"%XOnBattery%" = "False"' ErrorDescription="Only systems connected to AC power can be upgraded to Windows 10." /> <Check Text="Minimum memory > 2GB" CheckCondition='%XHWMemory% >= 2048' ErrorDescription="This system only has %XHWMemory%GB of memory and thus cannot be upgrade to Windows 10." /> <Check Text="CPU Supports Windows 8+" CheckCondition='%XCPUPAE% AND %XCPUNX% AND %XCPUSSE2% = True' ErrorDescription="Only systems with at least 1GB CPU or higher can be upgraded to Windows 10." /> <Check Text="25GB System Disk Free Space" CheckCondition='%YSystemDiskFreeSpaceGB% > 25' ErrorDescription="This system only has %YSystemDiskFreeSpaceGB%GB of free space and thus cannot be upgraded to Windows 10." /> </Action> </Actions> </UIpp>
|
|