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
Solved

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

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

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
An article on effective troubleshooting
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…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

860 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