|
Post by systmworks on May 8, 2019 3:18:26 GMT
Hello,
We are currently using the existing Preflight check to confirm a wired network is present. However what we would prefer to do is have a Preflight check that confirms its on the correct wired network by pinging a specific IP (such as our primary domain controller).
This helps ensure the Task Sequence will not fail when trying to join domain, upload Bitlocker key etc. The network in our building is a shared network with many VLAN's accessed by security certificates or MAC address bypass. Some of our imaging is done via a 4G router (most data is on the imaging USB stick) and if the 4G modem drops out the wired network from the router is still detected, even though our domain is not available.
Can the Preflight checks call a VBS script and use the output or exit code ?
We have a VBS code that pings our DC and exits with code 0 if it successfully pings, or -1 if it fails to ping.
Function Ping() On Error Resume Next Dim objPing, objRetStatus
set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _ ("select * from Win32_PingStatus where address = '" & sPingTarget & "'")
for each objRetStatus in objPing if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then WScript.Quit(-1) else WScript.Quit(0) end if next End Function
Ping("xxx.xxx.208.105")
I tried to call this as a Preflight check but could not get a successful result.
<Check Text="Ping DSD DC" CheckCondition='cscript.exe PingDC.vbs = "0"' />
Any help is appreciated.
|
|
petec
New Member
Posts: 10
|
Post by petec on May 14, 2019 14:52:11 GMT
Hey Systmworks.
I'm by FAR not an expert on UI++. I've only been using it since around June 2018.
In your example, I don't see where a task sequence variable was set for UI++ to pick up and compare against a condition.
I just tested and implemented this into my XML file and it works like a charm. You'll want to replace the IP address in the sample below. This executes a command, stores it as a TS variable, and then allows us to use it within UI++.
Quick note - this requires PowerShell to be part of your boot image.
<!-- ********************************** --> <!-- EXTERNAL CALLS FOR PREFLIGHT --> <!-- ********************************** -->
<Action Type="ExternalCall" Title="Check for local DC connectivity">powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment; $tsenv.Value('Connectivity') = Test-Connection -ComputerName "10.0.0.50" -quiet -Count 4}"</Action>
<!-- ********************************** --> <!-- PREFLIGHT CHECKS TO VERIFY MINIMUM REQUIREMENTS ARE MET --> <!-- ********************************** --> <Action Type="Preflight" Title="Preflight Checks" ShowOnFailureOnly="True"> <Check Text="WLAN Disconnected" CheckCondition='"%XWLANDisconnected%" = "True"' /> <Check Text="NOT on battery" CheckCondition='"%XOnBattery%" = "False"' /> <Check Text="Minimum memory > 3GB" CheckCondition='%XHWMemory% >= 3072' /> <Check Text="CPU Supports Windows 10+" CheckCondition='%XCPUPAE% AND %XCPUNX% AND %XCPUSSE2% = True' /> <Check Text="Ping local DC" CheckCondition='%Connectivity% = True' /> </Action>
I hope this helps. I think this may have also helped me with the issue I was experiencing.
PeteC
|
|
|
Post by Jason on May 21, 2019 22:03:25 GMT
👍👍
|
|
|
Post by systmworks on May 21, 2019 23:08:34 GMT
I hope this helps. I think this may have also helped me with the issue I was experiencing. PeteC Hey PeteC, Thanks a lot for your reply - that makes a lot more sense and a lot tidier than the VBS script I was using - more importantly it looks like it will actually work !
|
|
|
Post by systmworks on May 22, 2019 3:30:53 GMT
A quick update - I can confirm your suggestion above works like a charm, thank you.
The only 2 gotchas I noted were: - it does not work when testing from a CMD prompt on my computer (I think because the TSenvironment does not exist) which is how I normally test changes with the UI++ GUI screens
- the External Call task is displayed behind the SCCM Task Sequence Progress Bar box - the Progress Bar is only hidden once the normal Preflight Checks begin
|
|