Hello All,
For a project I'm working on, I need to get a VBScript working on WinPE which allows the user to map a network drive under their domain account. The script uses the following object classes:
- wscript.network
- ScriptPW.Password
- Scripting.FileSystemObject
The problem I'm running into is that since PE is stripped down, I can't seem to identify all the dependancies that I need to include in my WIM. At this point, I'm able to get the vbscript to kick off (I have to use the syntax "cscript.exe //E:Vbscript mapNetworkDrive.vbs"), but when it gets to the code where I have the user enter their password w/out showing the keystrokes on-screen, it does display the characters. After I hit enter, the script seems to freeze the console window. Hitting Control+C does not terminate it.
Before you ask; the script does run fine in any full version of x86 Windows.
I have the following DLLs included in my WIM and they get registered upon startup:
- scriptpw.dll
- vbscript.dll
- wshom.ocx
- scrrun.dll
Does anyone have any idea what other dependancies I might be missing?
Please see my code below:
Dim objNetwork, objPassword, strVolumeLabel, strRemoteShare, StdIn, StdOut, ISID, Password, fso, vlOK, path
set objNetwork = wscript.createobject("Wscript.Network")
Set objPassword = CreateObject( "ScriptPW.Password" )
Set StdIn = Wscript.StdIn
Set stdOut = WScript.StdOut
set fso = CreateObject("Scripting.FileSystemObject")
StdOut.Write "Please enter your ISID: "
ISID = StdIn.ReadLine
StdOut.Write "Please enter your Password: "
Password = objPassword.GetPassword()
stdOut.WriteLine ""
StdOut.Write "Please enter the network path you want to map: "
path = StdIn.ReadLine
vlOK = 1
do while vlOK = 1
StdOut.Write "Please enter the drive letter you want to use: "
strVolumeLabel = StdIn.ReadLine
if len(strVolumeLabel) <> 1 then
stdout.writeline "Please enter only one letter."
stdout.write "Please enter the drive letter you want to use: "
strVolumeLabel = StdIn.ReadLine
else
if fso.DriveExists(strVolumeLabel & ":") then
stdout.writeline "That Drive Letter is already in use."
else
vlOK = 0
end if
end if
loop
strvolumelabel = strvolumelabel & ":"
stdout.writeline ""
objNetwork.MapNetworkDrive strVolumeLabel, path, "False", ISID, Password
if fso.DriveExists(strVolumeLabel) then
stdout.WriteLine "The network drive was mapped successfully."
else
stdout.WriteLine "An error occurred when attempting to map the network drive."
end if
stdout.writeline "Press ENTER key to exit"
Do While Not WScript.StdIn.AtEndOfLine
Input = WScript.StdIn.Read(1)
Loop
Thanks in advance for any help!