You can use the Microsoft Diagnostic and Recovery Toolset (DaRT) 7 to establish a remote connection to a system where Windows 7 is being deployed with System Center Configuration Manager (SCCM) 2012 while in Windows PE. This is extremely helpful if you are deploying an operating system to a target system in a remote location where there is no IT staff and you or a technician need to troubleshoot an issue in Windows PE. In this post I provide information on setting this up.
If you are using SCCM to create your boot image, you can add the files specified in step 2 of this Johan's post using the "Add extra files" feature. Here I'm using this feature in my MDT-integrated create boot image wizard. In this case I added the files to d:\ExtraFiles\x86\Windows\System32 but pay attention that in the path I just specify d:\ExtraFiles\x86.
On the target system, run RemoteRecovery.exe while in Windows PE. You can use a "Run Command Line" step as illustrated below.
This will enable the system to accept incoming remote connections and show a window with the ticket number, IP address and Port that needs to be provided to the remote technician that wants to connect to this system.
However, if nobody is at the location where the target system is, how can the technician find this information? Fortunately, Nico Sienaert has shared a script that can automatically make this information available to the technician. I made a few changes to the script as in my case it was reporting the incorrect port number (script at the end of this post).
I configured the script to report the necessary information to a .cmd file which gets copied to a centralized share. The technician just needs to double-click on the .cmd file to establish a remote session to the target system. Notice that I have the script (called autoDaRT.vbs), MSDartCmn.dll and Interop.RDPCOMAPILib.dll in my share so a technician can run the script from a remote system without having DaRT installed (check your Microsoft license agreement before copying the DLL files to the share).
The .cmd files in the share have been automatically created by target systems while in Windows PE. These are the contents of one of these files (I have obscured the name of the server):
'====================================================================
'
'
' NAME: Automate Remote Monitoring (DaRT)
'
' AUTHOR: Nico Sienaert,
' DATE : 20/09/2011
'
' Modified by Romano Jerez on 8/29/2012
'
'=====================================================================
'Map network drive
Set objNetwork = CreateObject("WScript.Network")
strDriveLetter = "M:"
strHomeServer = "\\serverName\DaRT_Remote$"
strusername = "yourDomain\userName"
strPassword = "password"
strprofile = "false"
objNetwork.MapNetworkDrive strDriveLetter, strHomeServer, strprofile, strUsername, strPassword
Set oFSO = CreateObject("Scripting.FileSystemObject")
sFile = "X:\sms\bin\i386\inv32.xml"
If oFSO.FileExists(sFile) Then
Set oFile = oFSO.OpenTextFile(sFile, 1)
Do While Not oFile.AtEndOfStream
sText = oFile.ReadLine
If Trim(sText) <> "" Then
'Find Session ID
strfindID = InStr(sText, "ID=")
strfindID1 = strfindID + 4
strtofindID = Mid(sText,strfindID1,11)
'Find Port
strfindPort = InStr(sText, "P=")
strfindPort1 = strfindPort + 3
strtofindPort = Mid(sText,strfindPort1,5)
strtofindPort = strtofindPort + 1
'Find IP Address
strcomputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
strCount = 1
For Each objitem in colItems
If strCount = 1 Then
stripaddress = objitem.IPAddress(0)
'Create Batch File
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Open write stream
Set outFile = objFSO.CreateTextFile("M:\"& strtofindid &".cmd", True)
'Write each command line
outFile.WriteLine "\\serverName\DaRT_Remote$\DartRemoteViewer.exe" & " " & "-ticket=" & strtofindid & " " & "-IPaddress=" & stripaddress & " " & "-port=" & strtofindport
'Close write stream
outFile.Close
Else
End If
Next
End If
Loop
oFile.Close
Else
WScript.Echo "inv32.xml not found"
End If
Adding DaRT Files to Boot Image
The first step to accomplish this is to add the necessary DaRT files to your boot image. On a recent project, I used MDT 2012 to capture my reference image and create the boot image. It was easy to have MDT add the DaRT files to the image by following Michael Niehaus' instructions.If you are using SCCM to create your boot image, you can add the files specified in step 2 of this Johan's post using the "Add extra files" feature. Here I'm using this feature in my MDT-integrated create boot image wizard. In this case I added the files to d:\ExtraFiles\x86\Windows\System32 but pay attention that in the path I just specify d:\ExtraFiles\x86.
Run RemoteRecovery on Target System
On the target system, run RemoteRecovery.exe while in Windows PE. You can use a "Run Command Line" step as illustrated below.
This will enable the system to accept incoming remote connections and show a window with the ticket number, IP address and Port that needs to be provided to the remote technician that wants to connect to this system.
Run DaRT Remote Connection Viewer on Technician Computer
The technician runs DaRT Remote Connection Viewer and enters the ticket number, IP address and port used by the target system in Windows PE.This runs DartRemoteViewer.exe |
However, if nobody is at the location where the target system is, how can the technician find this information? Fortunately, Nico Sienaert has shared a script that can automatically make this information available to the technician. I made a few changes to the script as in my case it was reporting the incorrect port number (script at the end of this post).
I configured the script to report the necessary information to a .cmd file which gets copied to a centralized share. The technician just needs to double-click on the .cmd file to establish a remote session to the target system. Notice that I have the script (called autoDaRT.vbs), MSDartCmn.dll and Interop.RDPCOMAPILib.dll in my share so a technician can run the script from a remote system without having DaRT installed (check your Microsoft license agreement before copying the DLL files to the share).
The .cmd files in the share have been automatically created by target systems while in Windows PE. These are the contents of one of these files (I have obscured the name of the server):
Run Script in Task Sequence
I added the script to an SCCM package and run it in my task sequence.AutoDaRT VB Script (modify what's hi-lighted)
'====================================================================
'
'
' NAME: Automate Remote Monitoring (DaRT)
'
' AUTHOR: Nico Sienaert,
' DATE : 20/09/2011
'
' Modified by Romano Jerez on 8/29/2012
'
'=====================================================================
'Map network drive
Set objNetwork = CreateObject("WScript.Network")
strDriveLetter = "M:"
strHomeServer = "\\serverName\DaRT_Remote$"
strusername = "yourDomain\userName"
strPassword = "password"
strprofile = "false"
objNetwork.MapNetworkDrive strDriveLetter, strHomeServer, strprofile, strUsername, strPassword
Set oFSO = CreateObject("Scripting.FileSystemObject")
sFile = "X:\sms\bin\i386\inv32.xml"
If oFSO.FileExists(sFile) Then
Set oFile = oFSO.OpenTextFile(sFile, 1)
Do While Not oFile.AtEndOfStream
sText = oFile.ReadLine
If Trim(sText) <> "" Then
'Find Session ID
strfindID = InStr(sText, "ID=")
strfindID1 = strfindID + 4
strtofindID = Mid(sText,strfindID1,11)
'Find Port
strfindPort = InStr(sText, "P=")
strfindPort1 = strfindPort + 3
strtofindPort = Mid(sText,strfindPort1,5)
strtofindPort = strtofindPort + 1
'Find IP Address
strcomputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
strCount = 1
For Each objitem in colItems
If strCount = 1 Then
stripaddress = objitem.IPAddress(0)
'Create Batch File
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Open write stream
Set outFile = objFSO.CreateTextFile("M:\"& strtofindid &".cmd", True)
'Write each command line
outFile.WriteLine "\\serverName\DaRT_Remote$\DartRemoteViewer.exe" & " " & "-ticket=" & strtofindid & " " & "-IPaddress=" & stripaddress & " " & "-port=" & strtofindport
'Close write stream
outFile.Close
Else
End If
Next
End If
Loop
oFile.Close
Else
WScript.Echo "inv32.xml not found"
End If