Solved

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

Posted on 2013-02-04
4
2,286 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
  • 2
4 Comments
 
LVL 76

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.

758 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

23 Experts available now in Live!

Get 1:1 Help Now