Solved

Logon/Startup Script Copy Files and Register DLL's

Posted on 2013-06-04
11
1,710 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 54

Expert Comment

by:McKnife
ID: 39220183
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
ID: 39220337
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
ID: 39225611
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 54

Expert Comment

by:McKnife
ID: 39226337
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
ID: 39226549
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
 
LVL 54

Expert Comment

by:McKnife
ID: 39229570
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
ID: 39229711
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 54

Expert Comment

by:McKnife
ID: 39229750
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
ID: 39230085
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 54

Assisted Solution

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

Author Closing Comment

by:jwiang4u
ID: 39240441
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

830 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