Solved

Logon/Startup Script Copy Files and Register DLL's

Posted on 2013-06-04
11
1,635 Views
Last Modified: 2013-06-12
I need a way to copy down files from a network share to a program files folder and then register some of the DLL's contained within when a user logs onto a machine or when it starts up. I have a batch file that copies down the files and registers the DLLs but this doesn't work when run in the Startup folder because our users aren't local admins. I have tried using GPO Logon and Startup scripts but I can't quite get it to work. Thanks in advance for any advice.
0
Comment
Question by:jwiang4u
  • 6
  • 5
11 Comments
 
LVL 53

Expert Comment

by:McKnife
Comment Utility
Hi.

Startup scripts will definitely work (logon scripts of course don't for reasons given). So "I have tried using GPO Logon and Startup scripts but I can't quite get it to work" - what was the problem?
0
 
LVL 1

Author Comment

by:jwiang4u
Comment Utility
Thanks McKnife. I was able to get it to work by using the "net use" command to set credentials of a user that had permissions on the network shares where I was copying files from.

net use /persistant:no
net use \\server\ipc$ password /user:domain\user
call \\server\shares\batch_file.bat
0
 
LVL 1

Author Comment

by:jwiang4u
Comment Utility
Well I thought I had this figured out but there is still a problem. The startup script works on my Windows 8 machine but it doesn't seem to be working on any of the Windows 7 machines in the environment. Using the GPO Policy Wizard I can see that the GPO for the startup script is being applied so my WMI filtering and the GP are working. I am running on my machine as a user so that is consistent. Any advice?
0
 
LVL 53

Expert Comment

by:McKnife
Comment Utility
You can surely be helped if you give more info.
-what is going wrong?
-what is the output of the script?
-quote the script and the batch it uses
0
 
LVL 1

Author Comment

by:jwiang4u
Comment Utility
McKnife

The startup up script is a batch file that launches a batch file on a network share. This batch on the network share then copies files from the share into the Program Files on the user machine and registers some DLL's. What is wrong is that the files aren't being copied down to the user program files folder on there machines. What is confusing is that they are being copied down to my machine. The only difference is that my machine is windows 8 and theirs are Windows 7.

Here is a copy of the script which is a batch file with generic info substituted.

net use /persistant:no
net use \\server\ipc$ password /user:domain\user
call \\server\shares\batch_file.bat
Here are the contents of the batch file that it is calling.

mode 160, 50

REM Copy GP VBA files...
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\*.vba" "C:\Program Files (x86)\Microsoft Dynamics\GP2010" /Y

REM eConnect Lib Files...
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\Pinnacle.Lib.eConnect.dll" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\Pinnacle.Lib.eConnect.dll.config" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y

REM DataAccess Lib Files...
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\Pinnacle.Lib.DataAccess.dll" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y

REM Log Lib Files...
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\Pinnacle.Lib.Log.dll" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\Pinnacle.Lib.Log.dll.config" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y

REM BuildKit Files...
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoBuildKit.dll" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoBuildKit.dll.config" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoBuildKit.tlb" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoBuildKit.xml" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y

REM POPBuildKit Files...
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoPOPBuildKit.dll" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoPOPBuildKit.dll.config" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoPOPBuildKit.tlb" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoPOPBuildKit.xml" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y

REM IVBuildKit Files...
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoIVBuildKit.dll" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoIVBuildKit.dll.config" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoIVBuildKit.tlb" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoIVBuildKit.xml" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y

REM OrthoSOPPrintSelection Files...
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoSOPPrintSelection.dll" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoSOPPrintSelection.dll.config" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoSOPPrintSelection.tlb" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoSOPPrintSelection.xml" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y

REM OrthoSOPBatches Files...
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoSOPBatches.dll" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoSOPBatches.dll.config" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoSOPBatches.tlb" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoSOPBatches.xml" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y

REM OrthoCreatePOFiles...
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoCreatePO.dll" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoCreatePO.dll.config" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoCreatePO.tlb" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\OrthoCreatePO.xml" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y

REM InTransitTransfer Files...
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\InTransitTransfer.dll" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\Pinnacle.Utilities.PetaPoco35.dll" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\Application.FieldService.ModifiedForms.dll" "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns" /Y

REM GP supporting libs
xcopy "\\SERVER\GP\GPMaster\InitialDeployment\GP\*.*" "C:\Program Files (x86)\Microsoft Dynamics\GP2010" /Y


REM Register BuildKit
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns\OrthoBuildKit.dll" /CODEBASE

REM Register POPBuildKit
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns\OrthoPOPBuildKit.dll" /CODEBASE

REM Register IV Transaction
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns\OrthoIVTrans.dll" /CODEBASE

REM Register IVBuildKit
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns\OrthoIVBuildKit.dll" /CODEBASE

REM Register OrthoSOPPrintSelection
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns\OrthoSOPPrintSelection.dll" /CODEBASE

REM Register OrthoSOPBatches
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns\OrthoSOPBatches.dll" /CODEBASE

REM Register OrthoCreatePO
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe "C:\Program Files (x86)\Microsoft Dynamics\GP2010\AddIns\OrthoCreatePO.dll" /CODEBASE

Thanks.
0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 
LVL 53

Expert Comment

by:McKnife
Comment Utility
Hi.

We don't need batches that call batches that call batches. Take a single one and also avoid different credentials - the startup script runs with the system account (=Computername$), that account is a member of the domain group "authenticated users" and where that group has access to, so will the system account. So adjust it to one batch and skip the first batch - not needed, makes it only more complicated.

Also have the script log its output to a textfile and quote it here.
0
 
LVL 1

Author Comment

by:jwiang4u
Comment Utility
McKnife

I changed it to one batch file and I think I figured out the common denominator. Users connected directly to the main corporate switch are not processing Group Policy at startup because they can't establish a connection to the domain controller. Soon after they boot I get messages about successful group processing making me think that there must be some delay in establishing network connectivity at boot time. When they are connected to a switch that is then connected to the main corporate switch. Group Processing at startup succeeds and the script works fine. The exhibited behavior looks like what is referenced here: http://support.microsoft.com/?kbid=2459530 I am going to try the fixes referenced in the article and then I will get back with you.

Not sure why adding an additional switch in between fixes it though. Any thoughts are welcome.
0
 
LVL 53

Expert Comment

by:McKnife
Comment Utility
Ok, now you're getting somewhere :)
You should also give this policy a try (please note, it has to apply BEFORE the next reboot using gpupdate): http://support.microsoft.com/kb/305293
0
 
LVL 1

Accepted Solution

by:
jwiang4u earned 0 total points
Comment Utility
Ok. I turned on DHCP Client logging and found that there were several Ack timeouts when connected directly to the corporate switch. This delay means that Group Policy client was trying to run before the domain controller could be reached. I used the following KB article to extend the policy processing wait time to 60 seconds which did the trick.

http://support.microsoft.com/kb/2421599
0
 
LVL 53

Assisted Solution

by:McKnife
McKnife earned 500 total points
Comment Utility
Congratulations. Next time, for diagnosis, use fixed IPs.
0
 
LVL 1

Author Closing Comment

by:jwiang4u
Comment Utility
The KB article that I found fixed the problem but the advice of fixed IP's would have definitely helped with troubleshooting.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now