Post by vj on Jul 4, 2021 17:56:49 GMT
Hi,
I am trying to automate to get computer name which starts with "HY+Location+First four digit of serial number" but it produce only HY in computer name field. Please guide me what am i doing wrong and help me to correct the code.
PFB my xml code.
<Actions>
<Action Type="UserAuth" Title="User Authentication" Domain="mytestlab.com" MaxRetryCount="5" Group="CM-OSD-Admin" GetGroups="True"/>
<Action Type="DefaultValues" />
<Action Type="WMIRead" Variable="ComputerName" Namespace="root\cimv2" Class="Win32_ComputerSystem" Property="Name"/>
<Action Type="WMIRead" Variable="SerialNumber" Namespace="root\cimv2" Class="Win32_SystemEnclosure" Property="SerialNumber"/>
<Action Type="WMIRead" Variable="CurrentTier" Namespace="root\ITLocal" Class="Local_Config" Property="Tier"/>
<Action Type="RegRead" Hive="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion" Value="CurrentVersion" Variable="CurrentVersion" />
<Action Type="Info" Name="myInfo" Title="Welcome %XAuthenticatedUser%">
</Action>
<Action Type="Input" Name="ClientSetupInput" Title="Client Setup" ShowBack="True">
<ChoiceInput Variable="ZZBuildType" Question="Please select the build type for this system" Required="True" Default="2009">
<Choice Option="Windows 10 21H1" Value="19043" />
</ChoiceInput>
<CheckboxInput Variable="ZZExtraLogging" Question="Enable extra logging" CheckedValue="True" UncheckedValue="False" Default="True"/>
<ChoiceInput Variable="MyLocation" AlternateVariable="MyLocationAbbv" Question="Please choose an OU location for this computer" Required="True" Default="" >
<Choice Option="Chennai" Value="Chennai" AlternateValue="CHE"/>
<Choice Option="Bangalore" Value="Bangalore" AlternateValue="BLR"/>
</ChoiceInput>
<TextInput Question="Computer name:" Variable="ZZComputerName" Prompt="Computer Name" Default="HY%MyLocationAbbv%%HWSerialNumber%"/>
<Action Type="TSVar" Name="OSDDomainOUName" Condition='"%MyLocation%" = "Chennai"'>"LDAP://OU=CHE,OU=Workstations,OU=MyLab,DC=MyTestLab,DC=com"'</Action>
<Action Type="TSVar" Name="OSDDomainOUName" Condition='"%MyLocation%" = "Bangalore"'>"LDAP://OU=BLR,OU=Workstations,OU=MyLab,DC=MyTestLab,DC=com"'</Action>
<Action Type="TSVar" Name="MyLocation">"%MyLocation%"</Action>
<Action Type="TSVar" Name="OSDBuildType">"%ZZBuildType%"</Action>
<Action Type="TSVar" Name="OSDComputerName" >"%ZZComputerName%"</Action>
<Action Type="TSVar" Name="SMSTSUdaUsers">"%ZZUDAUsers%"</Action>
<Action Type="TSVar" Name="HWSerialNumber">Left("%ZZSerialNumber%",4)</Action>
<Action Type="WMIWrite" Namespace="root\ITLocal" Class="Local_Config" >
<Property Name="ComputerName" Type="CIM_STRING" Value="%ComputerName%" Key="True"/>
<Property Name="Tier" Type="CIM_UINT8" Value="%Tier%" Key="False"/>
</Action>
I am trying to automate to get computer name which starts with "HY+Location+First four digit of serial number" but it produce only HY in computer name field. Please guide me what am i doing wrong and help me to correct the code.
PFB my xml code.
<Actions>
<Action Type="UserAuth" Title="User Authentication" Domain="mytestlab.com" MaxRetryCount="5" Group="CM-OSD-Admin" GetGroups="True"/>
<Action Type="DefaultValues" />
<Action Type="WMIRead" Variable="ComputerName" Namespace="root\cimv2" Class="Win32_ComputerSystem" Property="Name"/>
<Action Type="WMIRead" Variable="SerialNumber" Namespace="root\cimv2" Class="Win32_SystemEnclosure" Property="SerialNumber"/>
<Action Type="WMIRead" Variable="CurrentTier" Namespace="root\ITLocal" Class="Local_Config" Property="Tier"/>
<Action Type="RegRead" Hive="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion" Value="CurrentVersion" Variable="CurrentVersion" />
<Action Type="Info" Name="myInfo" Title="Welcome %XAuthenticatedUser%">
</Action>
<Action Type="Input" Name="ClientSetupInput" Title="Client Setup" ShowBack="True">
<ChoiceInput Variable="ZZBuildType" Question="Please select the build type for this system" Required="True" Default="2009">
<Choice Option="Windows 10 21H1" Value="19043" />
</ChoiceInput>
<CheckboxInput Variable="ZZExtraLogging" Question="Enable extra logging" CheckedValue="True" UncheckedValue="False" Default="True"/>
<ChoiceInput Variable="MyLocation" AlternateVariable="MyLocationAbbv" Question="Please choose an OU location for this computer" Required="True" Default="" >
<Choice Option="Chennai" Value="Chennai" AlternateValue="CHE"/>
<Choice Option="Bangalore" Value="Bangalore" AlternateValue="BLR"/>
</ChoiceInput>
<TextInput Question="Computer name:" Variable="ZZComputerName" Prompt="Computer Name" Default="HY%MyLocationAbbv%%HWSerialNumber%"/>
<Action Type="TSVar" Name="OSDDomainOUName" Condition='"%MyLocation%" = "Chennai"'>"LDAP://OU=CHE,OU=Workstations,OU=MyLab,DC=MyTestLab,DC=com"'</Action>
<Action Type="TSVar" Name="OSDDomainOUName" Condition='"%MyLocation%" = "Bangalore"'>"LDAP://OU=BLR,OU=Workstations,OU=MyLab,DC=MyTestLab,DC=com"'</Action>
<Action Type="TSVar" Name="MyLocation">"%MyLocation%"</Action>
<Action Type="TSVar" Name="OSDBuildType">"%ZZBuildType%"</Action>
<Action Type="TSVar" Name="OSDComputerName" >"%ZZComputerName%"</Action>
<Action Type="TSVar" Name="SMSTSUdaUsers">"%ZZUDAUsers%"</Action>
<Action Type="TSVar" Name="HWSerialNumber">Left("%ZZSerialNumber%",4)</Action>
<Action Type="WMIWrite" Namespace="root\ITLocal" Class="Local_Config" >
<Property Name="ComputerName" Type="CIM_STRING" Value="%ComputerName%" Key="True"/>
<Property Name="Tier" Type="CIM_UINT8" Value="%Tier%" Key="False"/>
</Action>