Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SWbemObjectEx: Critical Error

Status
Not open for further replies.

chriscj21

Technical User
Mar 27, 2004
246
GB
All.....

Has anyone else ever come across this - I am creating an unattended XP install.....

I am using a cmdlines.txt file to call a batch file - this batch file has two lines:

*************************************************

CScript "C:\Install\Share_Upgrade.vbs"

CScript "C:\Install\Share_log.vbs"
**************************************************

should I run this batch file, when it gets to the lines above I get an:

SWbemObjectEx: "Critical Error" message.....
****************************************************

If I run these files from within windows they work fine - doe for files as follows:

File 1:
****************************************************

Const FILE_SHARE = 0
Const MAXIMUM_CONNECTIONS = 25
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set objNewShare = objWMIService.Get("Win32_Share")
errReturn = objNewShare.Create _
("C:\Program Files\Controller\controller\upgrade", "Upgrade", FILE_SHARE, _
MAXIMUM_CONNECTIONS, "Upgrade Folder Share")
*******************************************************
File 2:
*****************************************************
Const FILE_SHARE = 0
Const MAXIMUM_CONNECTIONS = 25
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set objNewShare = objWMIService.Get("Win32_Share")
errReturn = objNewShare.Create _
("C:\Program Files\controller\controller\log", "tlog", FILE_SHARE, _
MAXIMUM_CONNECTIONS, "Log Folder Share")
******************************************************

Anyone any ideas why I get this message?



Help much appreciated




ChrisCj21
MCSE, A+, N+
 
I think this happends because you're using cmdlines.txt. Cmdlines is processed before the OS installation is finished, cmdlines is executed right before the last OS boot.

However there are several ways to accomplish this :

1) Use cmdlines.txt and initiate an autologon through a reg file after the OS successfully has been installed.

Ex Cmdlines :
Code:
[Commands]
"C:\regedit.exe /s C:\Run.reg"

Ex Regfile :
Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"script1"="c:\\script\\script1.vbs"
"script2"="c:\\script\\script2.vbs"


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"DefaultUserName"="Administrator"
"AutoAdminLogon"="1"
"DefaultPassword"="yourpassword"
"ForceAutoLogon"="1"

You can omit the winlogon key, and use autologon in sif/unattended file. If using above excample you must be sure to remove the autologon after the job is done.

2)
Use autologon in sif/unattended.txt in conjuction with the GuiRunOnce section of sif/unattend.

Ex sif :
Code:
[GuiRunOnce]
"script1.vbs"
"script.2.vbs"
 
Thanks JadeKnight!!!

One thing tho, I thought CMDLINES.TXT and GUIRunOnce BOTH ran at T13/12?

Could you claify the benefit of using either?

As it happens I have added the entries for the vbs files in reg - much easier ;)


ChrisCj21
MCSE, A+, N+
 
Cmdlines.txt A configurable text file that you use to customize an unattended installation. Cmdlines.txt contains a list of commands that run synchronously after Setup finishes, but before a computer restarts. Cmdlines.txt can exist on the destination computer’s hard disk or on a floppy disk, and must be specified in the [Unattended] section of Unattend.txt or Winnt.sif.

[GUIRunOnce] A section in your answer file that is used to customize an unattended installation. The [GUIRunOnce] section contains a list of commands that run synchronously after a destination computer is started for the first time and a user logs on.

Use Cmdlines.txt when:

You are running commands, programs, scripts, or batch files from the $OEM$ folder on a distribution share.
You want to install applications or perform configuration tasks during GUI mode stage of Setup.
You want to install applications or perform configuration tasks under the Local System security account.
You do not need network connectivity to perform the installation or configuration task.
You are not using Windows Installer packages (.msi files) to install applications.
You want to install applications or perform configuration tasks while no user is logged on.

Use [GuiRunOnce] when:

You need access to hard drives, CD-ROM drives, shared folders on the network, or other storage devices.
You want to install applications or perform configuration tasks under a specific user account.
You need network connectivity to perform an installation or configuration task.
You are using Windows Installer packages (.msi files) to install applications.
You need to control the order in which programs, scripts, or batch files run.

Reference :
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top