Sign in to follow this  
Followers 0
avery

Is this a bug? Please help.

11 posts in this topic

#1 ·  Posted (edited)

Several times I've attempted to do something I would consider very simple. I'm trying to copy a scripts.ini file to the GroupPolicy\User folder as admin.

FileCopy("C:\proj\au3\scripts.ini", "C:\WINDOWS\system32\GroupPolicy\User\Scripts\scripts.ini") ; This fails

However this next one works just fine.

FileCopy("C:\proj\au3\scripts.ini", "C:\proj\au3\scripts2.ini") ; Bingo!

I'm running all this as admin and I've used the attrib -H command on the folder but it still shows hidden in File Explorer. This is very confusing to me please advise.

btw I love au3 so far, having lots of fun until getting stuck now

edit: I just tried more things with no luck.

Run(@ComSpec & ' /k attrib -H -S -R C:\WINDOWS\system32\GroupPolicy')

Run(@ComSpec & ' /k attrib C:\WINDOWS\system32\GroupPolicy')

FileInstall("C:\proj\tmp\test.txt", "C:\WINDOWS\system32\GroupPolicy\test.txt") ; Fails

It seems to be some permissions on GroupPolicy folder I just can't figure out :D

Edited by avery

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You need to create the directory first, DirCreate("C:\WINDOWS\system32\GroupPolicy\User\") :D

Edit: now I saw that you couldn't even write to GroupPolicys, try making yourself the owner of the dir

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

You need to create the directory first, DirCreate("C:\WINDOWS\system32\GroupPolicy\User\") :D

Edit: now I saw that you couldn't write to GroupPolicys, try making yourself the owner of the dir

Thanks.

I have all those directories already and I bet you do too. They are Default Windows folders that GroupPolicy information is stored in, run gpedit.msc.

Can you see if these commands work for you and your folder: C:\WINDOWS\system32\GroupPolicy\Machine\Scripts Also User\Scripts


www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites

Thanks.

I have all those directories already and I bet you do too. They are Default Windows folders that GroupPolicy information is stored in, run gpedit.msc.

Can you see if these commands work for you and your folder: C:\WINDOWS\system32\GroupPolicy\Machine\Scripts Also User\Scripts

Nope I don't, my GroupPolicy folder is empty.

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Nope I don't, my GroupPolicy folder is empty.

That is ok. Try to use FileCopy and copy from a tmp folder into it and see if it errors please :D


www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites

I tried your above script and it worked, running on Vista btw.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

That is odd. I have two separate computers. My computer at work and my laptop at home both running XP pro. I can't see to copy anything with au3 into a Hidden system folder like GroupPolicy. The SetAttr commands in au3 are not working on those types of folders either. I will try it on a fresh install at work tomorrow but I get a feeling it's a bug.


www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites

That is odd. I have two separate computers. My computer at work and my laptop at home both running XP pro. I can't see to copy anything with au3 into a Hidden system folder like GroupPolicy. The SetAttr commands in au3 are not working on those types of folders either. I will try it on a fresh install at work tomorrow but I get a feeling it's a bug.

This worked fine on both XP Pro PCs here:
$var = FileCopy(@HomeDrive & "\test.ini", @SystemDir & "\GroupPolicy\User\Scripts\script.ini", 1)
MsgBox(64, "Info", "FileCopy succeeded: " & ($var == 1))
Notice the 3rd parameter of FileCopy(). Maybe you already had the file there.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

This worked fine on both XP Pro PCs here:

$var = FileCopy(@HomeDrive & "\test.ini", @SystemDir & "\GroupPolicy\User\Scripts\script.ini", 1)
MsgBox(64, "Info", "FileCopy succeeded: " & ($var == 1))
Notice the 3rd parameter of FileCopy(). Maybe you already had the file there.
The 3rd argument fixed me so far and thanks for the help.

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I am now having a similar issue again at home on my WinXP 64bit box.

$var = DirCreate(@SystemDir & "\GroupPolicy\Machine\Scripts")
    ConsoleWrite($var)

$var comes back as 0

the 'Scripts' dir does not exist but 'Machine' dir does and this will not create the Scripts dir

I am running this as admin, anyone know what my error is please?

This worked fine on my 32bit box at work :D

---

edit:

This works, creates NIDAQ and backup dirs

DirCreate(@ProgramFilesDir & "\NIDAQ\Backup")
Edited by avery

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0