如何在WinPE中运行VBscript [英] How to run a VBscript in WinPE

查看:166
本文介绍了如何在WinPE中运行VBscript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,



对于我正在开发的项目,我需要在WinPE上运行VBScript,允许用户在下面映射网络驱动器他们的域帐户。该脚本使用以下对象类:



- wscript.network

- ScriptPW.Password

- 脚本.FileSystemObject



我遇到的问题是,由于PE被剥离,我似乎无法确定我需要包含在我的所有依赖项中WIM。此时,我能够启动vbscript(我必须使用语法cscript.exe // E:Vbscript mapNetworkDrive.vbs),但是当它到达我让用户输入的代码时他们的密码w / out显示屏幕上的击键,它确实显示字符。点击Enter后,脚本似乎冻结了控制台窗口。点击Control + C不会终止它。



在你提出之前;该脚本在x86 Windows的任何完整版本中运行良好。



我的WIM中包含以下DLL,并且它们在启动时注册:

- scriptpw.dll

- vbscript.dll

- wshom.ocx

- scrrun.dll



有没有人知道我可能缺少哪些其他依赖?



请参阅下面的代码:



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!

推荐答案

您已添加3包

1. WinPE-HTA.cab

2.WinPE-Scripting.cab

3.WinPE-Wmi.cab





要添加Hta pakege,请按以下链接访问MSDN

WinPE:添加包(可选)组件参考) [ ^ ]



其他两个就像MSDN链接一样但更改套餐名称



谢谢.....



注意:包装有两个版本64和32位根据您的要求添加包装
you have add 3 Package
1. WinPE-HTA.cab
2.WinPE-Scripting.cab
3.WinPE-Wmi.cab


To add Hta pakege follow the link of MSDN
WinPE: Add packages (Optional Components Reference)[^]

other two as like MSDN link but change the Package name

thanks .....

note: package have two version 64 and 32 bit as per your requirement add you packages


这篇关于如何在WinPE中运行VBscript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆