Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy a file

Status
Not open for further replies.

dezzemm

Technical User
Sep 10, 2003
36
AU
I manage a small network but dont have any vbs expertise.

My problem is that I have a piece of software that writes an ini file to the windows directory on the pc each time it exits.

However, only an admin login will enable this to happen - anything below gets a permissions error. If I create the ini file as admin and then edit the security to enable EVERYONE write access, then other users will run that progeam and have no trouble writing to the ini file and can exit ok.

I tried to add a batch command via the login script to copy a working copy of that ini file to other pcs but that also only writes if its an admin login.

I am thinking of trying a vbs script via Group Policy for all computers and hope that might get around it.

The command that works is..
copy P:\WebInfo.ini C:\Windows\

where p is the network drive and that file is the edited one that has worked on a test machine with a non-admin user.

Thanks
Dzm
 
Code:
set objFSO = CreateObject("Scripting.FileSystemObject")

strSource = "P:\WebInfo.ini"
strDestination = "c:\windows\"

objFSO.CopyFile strSource, strDestination, true 'overwrite if neccessary

Although, the issue may be with the rights and permissions of the user on the destination machine. Even if the file grants EVERYONE full control, if the user copying the file does not have the necessary rights on the destination machine, the file will not be copied.

-Geates
 
Thanks heaps, I will try it and see - but it looks as though it could be fruitless given what you said about the user permissions, which I am aware is the basic issue.

My computer by computer manual admin login job looks the best bet in the end.

Cheers
dzm
 
Is there a way to add Domain Users to the local administrator group via a script?? This will get the software to work for any user (but not the best option though!).
 
When I run the vbs i get an error message:
line 6
char 1
Error File not found
Code 800A0035
Source Microsoft VBScript runtime error

It comes with all logins - but the file is there

I changed P: to \\server\programs\ but that made no difference - and i did that also because with the P: i got path not found message - which changed to no file message afterwards

Hmm - i could have explained that better!!
 
Whoops - filename was wrong - it was WebImage.ini -

BUT anyway the copied file with everyone having access to it gets its security changed to the default windows setting using this method meaning the software wont work properly -

well it works - its just that it tries to write to that ini file and of course gets stopped - so the issue is actually getting out without going to CTRL-ALT-DEL!!
 
>> so the issue is actually getting out without going to CTRL-ALT-DEL

I don't follow..

-Geates
 
This program is a single exe file and it can run from a local drive, network drive, usb etc. There is no problem with this and it performs ok for any user.

The problem is that it creates an ini file in the windows directory and writes to it on exiting. The permissions of the windows directory are such that a domain user without admin rights cant write to this file and users are forced to use CTRL-ALT-DEL to exit from it. (A message comes up in German so I don't exactly know what it says)

The program can be overcome if an admin user (local/domain) edits the file in windows and gives everyone permission to write to that ini file. After that there is no probelm exiting.

My thought was to edit one ini file on a pc and copy that ini file to the network drive - and create a script that would then place the edited/amended file on all workstations. Your script has enabled the copying to occur but the copied file still assumes the default windows permission settings.

I hope I have explained it clearly enough now - it was bit jumbled before what I was trying to achieve.

Cheers and Thanks
Dzm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top