Solved

need a vbscript to copy a file to c:\windows, access denied error

Posted on 2013-02-04
4
2,377 Views
Last Modified: 2013-02-04
Hi all,

I need a vbsript to copy a file to c:\windows folder for all Windows XP users
i use this script :

Dim objFSO
Const OverWriteExisting = True
Set objFSO = Createobject("Scripting.FileSystemObject")
wsLocation = "C:\windows\saplogon.ini"
objFSO.CopyFile "\\server01\SAPGUI7.20INI\saplogon.ini", wsLocation, OverWriteExisting

but it gave me access denied when running as logon script via GPO
0
Comment
Question by:gsawan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 78

Accepted Solution

by:
arnold earned 500 total points
ID: 38853488
Login script runs with the credentials of the user and is often lacks write rights.

You can use psexec and do a remote copy or use it as a startup script in a computer OU GPO.
This will copy the data only when the system boots.
Depending what the file is that you want to copy, you could change the permissions, but those may get overwritten/reset.
0
 
LVL 1

Expert Comment

by:PIExpatriate
ID: 38853660
Why not simply use a batch file?

@echo off
cls
copy /y "\\server01\SAPGUI7.20INI\saplogon.ini" "%windir%"
exit

Open in new window

0
 

Author Comment

by:gsawan
ID: 38853683
Hi PIExpatriate

the idea behind this task is to copy the saplogon.ini file to all domain users' c:\windows\ using GPO with startup script, that is why we have to use a vbs script , the vbscript will call the bat file, it should be a problem, the problem is the permission to drop a saplogon.ini file into the c:\windows protected folder where i get the access denied error.
i will test it again with startup script and computer GPO.
Thanks!
0
 

Author Comment

by:gsawan
ID: 38853766
to update you all,

i got it working now, using my script above,
as Arnold said above, i used it as a startup script in a computer OU GPO, and with that settings, it does have permission to copy file to c:\windows folder
all good now,
many thanks!
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
A small collection of useful tips and tricks for Windows 10 users that I decided to write as a result of recent questions that were asked and answered at Experts Exchange. Two short video tutorials included. Enjoy..
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

729 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