Solved

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

Posted on 2013-02-04
4
2,351 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
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 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.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

730 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