?
Solved

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

Posted on 2013-02-04
4
Medium Priority
?
2,421 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 79

Accepted Solution

by:
arnold earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

770 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