Skip to content

Creating a Simple Package using batch file

Featured Replies

Hello,

I have struggling hard to create a simple package using a batch file. Probably if some one can help

 

I need to copy DLL file to c:\windows\system32 directory on all managed clients. Also

I need to run .reg file on all client workstations which will create keys in the registry.

 

Action I took:

I created a batch file using

copy \\ServerName\.... c:\windows\system32

regedit /S \\Servername\path\register.reg

 

I than go up and create a standard program from the Package --> New Package wizard.

 

However i am unable to copy these files to system32 directory.

 

Is there a different way to create such packages??

Where should i search for error logs on client side ??

Have a package with your files in it and a batch file also:

The syntax so it deploys from the DP

----------------------------------------------------------------------------------

@Ehco

copy %~dp0filename1.extension "c:\windows\system32"

copy %~dp0filename2.extension "c:\windows\system32"

copy %~dp0filename3.extension "c:\windows\system32"

copy %~dp0filename4.extension "c:\windows\system32"

copy %~dp0filename5.extension "c:\windows\system32"

regedit.exe /s regkeys.reg

@Exit

---------------------------------------------------------------------------

 

your rekeys.reg would have to be taken from a machine with the app installed!! Put all the keys into one AKA regkeys.reg

 

Rocket Man

  • Author

Hello Rocket Man,

Not sure, if i have understood correctly, requesting to confirm steps below.

 

Step1.

I created a batch file : DLL.bat (with exactly the same contents as below)

@Ehco

copy %~dp0passwordreset.dll "c:\windows\system32"

copy %~dp0msvcrt100.dll "c:\windows\system32"

regedit.exe /s regkeys.reg

@Exit

 

My doubt in step1.

Doubt1

should i use the commandline regedit.exe /s regkeys.reg in the batch file OR I need to replace with my actual registry files as below

regedit.exe /s unregister.reg

regedit.exe /s unregister.reg

Doubt2

should i use the inverted commas as "c:\windows\system32" OR

c:\windows\system32

 

 

Step2:

I copied this batch file, passwordreset.dll, msvcrt100.dll , unregister.reg and register.reg inside \\sccmsrv\software\dll folder. The software folder is shared for everyone

 

Step3:

I create a package using below steps

Package --> create package --> The package contains source files (pointed to the \\sccmsrv\software\dll\ ) folder. Selected "Do not create a Program". This only created a package.

 

Step4

I then distributed it to DP's via "Distribute Content"

 

Step5

I than apply to collections.

 

 

Regards

Irfan

  • Author

Step3: Correction

I create a package

Package --> Create Package --> The package contains source files (pointed to the \\sccmsrv\software\dll\ ) folder. Select "Create a Standard Program"

  • Author

Hi Rocket Man,

Updates:

I was able to copy the 2 Dll files. However it didnot get copied to c:\windows\system32. It copied to C:\Windows\SysWoW64 . I am running hardware x64 with win7 x64 editions. The registry also didnot execute.

The registry should execute if you have all the registry enteries in the one registry key called regedit.reg, if all keys are specified in this and where to add to the registery it should work!!

 

Works well for me on a specific piece of software!!

 

As for your other problem .....well atleast the files are now copying to the local machine, unfortunately I can give you no more assistance on this area as I only run x86 clients so have no idea as to why they are copying to the sysWOW64 folder??

 

Maybe some one else knows and would like to contribute?

 

Rocket Man

  • Author

Thanks RocketMan,

Yes you are absolutely right. The registry also got executed but it got executed in HKLM--> software --> WOW6432 node --> Microsoft --> windows --> ..... instead of HKLM --> software --> Microsoft.

 

Thanks for your help. If i am able to resolve this , i will definately update you..

 

Thanks once again for your great support.

 

Regards

  • 3 weeks later...

Instead of regedit.exe /s regkeys.reg use reg import regkeys.reg /reg:64

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.