Inicio > Sin categoría > Function to get the computer domain from WINPE

Function to get the computer domain from WINPE

 

Function OldDomainName()
On Error Goto 0

If oEnvironment.Item("OSVERSION")="WinPE" Then
  Dim DomainName : DomainName = ""
  Dim ret, sOldSystem : sOldSystem = ""
  For Each drv In Array("C", "D", "E", "F")
   If ofso.FileExists(drv & ":\windows\system32\config\system") Then
    sOldSystem = drv & ":\windows\system32\config\system"
    Exit For
   End If
  Next
  oLogging.CreateEntry "Mounting Offline registry " & sOldSystem, LogTypeInfo
  ret = oShell.Run ("reg load HKLM\z " & sOldSystem, 0, True)
  If ret = 0 Then
   DomainName = oShell.RegRead("HKLM\z\ControlSet001\Services\Tcpip\Parameters\Domain")
   If DomainName <> "" Then
    oLogging.CreateEntry "Found old domainname ‘" & DomainName & "’", LogTypeInfo
   Else
    oLogging.CreateEntry "Old domainname name could not be found", LogTypeWarning
   End If
  Else
   oLogging.CreateEntry "Could not mount offline registry " & sOldSystem, LogTypeWarning
  End If
  oShell.Run "REG UNLOAD HKLM\Z", 0, True 
End If

OldDomainName = CStr(UsmtParam)
 
End Function

Categories: Sin categoría Tags:
  1. Sin comentarios aún.
  1. Sin trackbacks aún.