Script to deploy .cab files into C:\WINNT\system32 directory & register the .dll file into client Machine automatically

biplabmukherjee
biplabmukherjee used Ask the Experts™
on
Hi All / Chris Dent,

Gys could you please help me out to create the script which will deploy the .cab files to all client machine into the directory C:\WINNT\system32 & register the all .dll   files automatically into the registry for all client machine. I am explaining in brief what my objective is I have one .cab files which contains various .dll & .rll files. I need to deploy this .cab files to all client machine as well as the script should registered .the all .dll & .rll files automatically to registry to all client Machine. File name is RSClientPrint.cab & inside this cab files there are several .dll & .rll files . files details are given below.

RSClientPrint.dll
RSClientPrint_1028.rll
RSClientPrint_1031.rll
RSClientPrint_1033.rll
RSClientPrint_1036.rll
RSClientPrint_1040.rll
RSClientPrint_1041.rll
RSClientPrint_1042.rll
RSClientPrint_1043.rll
RSClientPrint_1046.rll
RSClientPrint_1053.rll
RSClientPrint_2052.rll
RSClientPrint_3082.rll

Chris Dent:-- Hi Chris can you please help me out to creating this script & solve this issue.

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Add this lines in the batch files


keep the RSClientPrint.cab  in a shared location with required access in the server


extract \\Servername\sharedfolder\RSClientPrint.cab  /L %systemroot%\system32\

Regsvr32 %systemroot%\system32\RSClientPrint.dll
Regsvr32 %systemroot%\system32\RSClientPrint_1028.rll
Regsvr32 %systemroot%\system32\RSClientPrint_1031.rll
Regsvr32 %systemroot%\system32\RSClientPrint_1033.rll
Regsvr32 %systemroot%\system32\RSClientPrint_1036.rll
Regsvr32 %systemroot%\system32\RSClientPrint_1040.rll
Regsvr32 %systemroot%\system32\RSClientPrint_1041.rll
Regsvr32 %systemroot%\system32\RSClientPrint_1042.rll
Regsvr32 %systemroot%\system32\RSClientPrint_1043.rll
Regsvr32 %systemroot%\system32\RSClientPrint_1046.rll
Regsvr32 %systemroot%\system32\RSClientPrint_1053.rll
Regsvr32 %systemroot%\system32\RSClientPrint_2052.rll
Regsvr32 %systemroot%\system32\RSClientPrint_3082.rll

Author

Commented:
Thanks for the quick response. Can we incorporate all these codes into VBscript. Suppose If I copy all these contain & copy into notepad & save it as .vbs will it work ? Because I need to deploy all these codes centrally may be using group policy.
No, you need to make some changes for making it in VB, i will update and send u shortly
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

I missed something in the above, extract.exe will not be by default present in windows, you need in install it which you can get it from support tools, keep extract.exe in server location where you are going to keep the folders
and  run the script below from the client

	Set oShell = WScript.CreateObject("WScript.Shell")
	
		strWinDir = oEnvironment("windir")
		
	
			oShell.Run "\\servername\extract.exe \\Servername\sharedfolder\RSClientPrint.cab  /L %systemroot%\system32\",1,true
		
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1028.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1031.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1033.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1036.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1040.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1041.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1042.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1043.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1046.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1053.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_2052.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_3082.dll",1,True
 
		Set oShell = Nothing
		

Open in new window

U have wrongly mentioned the extension as Rll, i have change to Dll
thrid line should be

                  oShell.Run "\\servername\sharedfolder\extract.exe \\Servername\sharedfolder\RSClientPrint.cab  /L %systemroot%\system32\",1,true
            
Chnage - \\servername\sharedfolder\ to your server and share

Author

Commented:
Ok thanks for the update. extract.exe do i need to install from windows server 2003 support tool? if not from where i can get it please tell me & should I placed extract.exe on the same location where i need to keep .cab file?
You can download Support tools from below -

http://www.microsoft.com/downloads/details.aspx?FamilyId=6EC50B78-8BE1-4E81-B3BE-
4E7AC4F0912D&displaylang=en


should I placed extract.exe on the same location where i need to keep .cab file? Yes,

You can see that script is calling extract.exe from a share location and extract the files in another shared location
you can either keep in same location or different,it's upto you

Author

Commented:
ok thanks

Author

Commented:
Hi I have modified the third line as u said but while running the script i m getting error message . can u plz check

oShell.Run "\\IN2-USER-2K3VM\RS\extract.exe \\IN2-USER-2K3VM\RS\RSClientPrint.cab  /L %systemroot%\system32\",1,true

Author

Commented:
I am getting this error message .Please find attached file.
scripterror.bmp
After the line - Set oShell = WScript.CreateObject("WScript.Shell")

Please add the following line


      Set oEnvironment = oShell.Environment("Process")

Author

Commented:
Ok. now there is no error as such . but while executing this script it will prompt me to run the extract.exe or not & one more thing how will I know that script has extracted from .cab files & pasted onto the system32 directory. Becoz i have searched all the files under system32 directory but none of the files are exits after executing this script. So I need to make sure that files are copied is desired location as well as the registry also edited by script. I m attaching the screenshot please review it.

Author

Commented:
sorry missed out the attachment
info.bmp
I have made some modification which does not require extract, i used expand which present by default


	Set oShell = WScript.CreateObject("WScript.Shell")
		Set oEnvironment = oShell.Environment("Process")
		strWinDir = oEnvironment("windir")
		
	
		 
				oShell.Run "%comspec% /c %windir%\system32\expand.exe \\IN2-USER-2K3VM\RS\RSClientPrint.cab  %windir%\system32\",1,True
			 
		
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1028.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1031.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1033.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1036.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1040.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1041.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1042.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1043.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1046.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1053.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_2052.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_3082.dll",1,True
 
		Set oShell = Nothing

Open in new window

Author

Commented:
Nope its not copying the .dll file into system32 directory .
Seems it was due to the difference in Expand.exe version, give a try using the below

 
 
	Set oShell = WScript.CreateObject("WScript.Shell")
		Set oEnvironment = oShell.Environment("Process")
		strWinDir = oEnvironment("windir")
		
	
		 
				oShell.Run "%comspec% /c %windir%\system32\expand.exe -F:*.* \\IN2-USER-2K3VM\RS\RSClientPrint.cab  %windir%\system32\",1,True
			 
		
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1028.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1031.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1033.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1036.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1040.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1041.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1042.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1043.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1046.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_1053.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_2052.dll",1,True
			oShell.Run 	"%comspec% /c %windir%\system32\regsvr32.exe /s %windir%\system32\RSClientPrint_3082.dll",1,True
 
		Set oShell = Nothing

Open in new window

Author

Commented:
script is working & its copied all files to system32 directory. so now how will i now in registry editor that .dll file has been registered.
Copy the below line  ( I have removed /s from it, which is silent ) and run this in command prompt


%windir%\system32\regsvr32.exe  %windir%\system32\RSClientPrint_1028.dll

If it run here it will run there too, u can remove  /s from the script and check

Author

Commented:
My question not to execute this I just want to make sure that .dll file has been registered. How will I know this please let me know. If do this as you said above will I identify that .dll file is registered?

Author

Commented:
I have checked it showing DllregisterServer in C:\windows\system32\RSclientprint.dll succeeded.

Author

Commented:
i have just tested one file . if one file succeded it means all other file also registed in registry right?

Author

Commented:
sorry to trouble you so much . If i deploy this script through group policy will it work? I am executed this script manually for testing now I need to deploy this to 100 of cilent machine. Please advise.

Thanks
sorry i am on the way home.yes, it is designed to work for group policy.any issue let me knw.

Author

Commented:
sure thanks for all your effort to solve this issue. Thanks once again
Accepted with Pleasure

Author

Commented:
satisfied with the solutions

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial