Group Policy Logon / Startup Script Issues

Having difficulty getting a script to run and hoping someone can help. I'm trying to run a script on Windows 7 PC's when users logon it checks to see if the Lync 2013 client is installed and if not install it. It should then check if the PC has Lync 2010 client installed and if so remove it.

If I run the script using Group Policy under the User Config / logon script the Lync 2013 client files are copied over but the installation fails due to insufficient permissions ( works if user is a local admin). If I run the script under the Computer Config / startup script nothing happens at all. I think the issue may be the syntax i'm using but i'm unable to figure it out.

:BEGIN
IF EXIST "c:\Program Files\Microsoft Office\Office15\Lync.exe" GOTO END
IF EXIST "c:\Program Files(x86)\Microsoft Office\Office15\Lync.exe" GOTO END
ELSE GOTO ONE
:ONE
net use v: \\Share\Files
xcopy "V:\Lync2013\x86\*" "c:\Files\Lync2013\" /s /e
c:\Files\Lync2013\setup.exe /adminfile setup.MSP
IF EXIST "c:\Program Files\Microsoft Lync\communicator.exe"
       xcopy v:\Lync2010\* c:\Files\Lync2010\ /s /e
       c:\Files\Lync2010\LyncSetup.exe /Uninstall /Silent
       net delete v:
ELSE net delete v:
:END
LVL 1
misfit139Systems AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Cliff GaliherCommented:
Regarding the script not running at startup, is the GPO linked to an OU that has computer objects?
0
misfit139Systems AdministratorAuthor Commented:
I'm using a Windows 7 test PC that sits in the OU the GPO is linked to.
0
Cliff GaliherCommented:
Well, as a matter of troubleshooting, I'd add an echo to the batch file that appends a line to a text file, to see if the script is firing at all.

If it is, my next suspicion is that the file share you are mounting does not have permissions set to allow the computer account to read and copy the installer files.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Ben Personick (Previously QCubed)Lead Network EngineerCommented:
Since the script only Copies the files unless run as a local admin, I'm guessing the user does not have permissions to install the item.
0
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
One thing you could do is use run as, however that does not allow putting a password into the script to authenticate with.

Another option is to grant users the rights to install files.

Another option is to schedule the script to run as local admin using schtasks, and then execute it immediately.  Schtasks allows you to authenticate as a different user, and also allows you to schedule the task to run as a specific user.
0
Mohammed KhawajaManager - Infrastructure:  Information TechnologyCommented:
The solution is to run the script for a GPO that is Computer Policy and it should be linked to OUs where the computers reside.  I have done similar with Symantec Enterprise Vault clients and it works without any issues.

When linked to run as user logon, it runs under the logged on user context which means it will fail for most users.
0
misfit139Systems AdministratorAuthor Commented:
Thanks all for your responses, it turned out it was actually working (to a point) but I was of the belief the startup script had to finish running before a user could log in so when I was able to log in straight away I'd assumed it wasn't. Also without the /Y switch after the xcopy it was prompting to overwrite the files copied from previous attempts. Adding the ECHO's after each line really helped in figuring out where it was failing. This is what i've ended up with and it's working well so far,  

:BEGIN
IF EXIST "c:\Program Files\Microsoft Lync\communicator.exe" xcopy "\\Share\Files\Lync2010\*" "c:\Files\Lync2010\" /s /e /y
IF EXIST "c:\Program Files\Microsoft Lync\communicator.exe" c:\Files\Lync2010\LyncSetup.exe /Uninstall /Silent
IF EXIST "c:\Program Files\Microsoft Office\Office15\Lync.exe" GOTO END
IF EXIST "c:\Program Files(x86)\Microsoft Office\Office15\Lync.exe" GOTO END
xcopy "\\Share\Files\Lync2013\x86\*" "c:\Files\Lync2013\" /s /e /y
c:\_Source\Lync2013\setup.exe /adminfile setup.MSP
:END
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.