Sign in to follow this  
Followers 0
coondog7820

File Permission issue with Win Server 2008

4 posts in this topic

I have been working on a script as custom wrapper around an installer that is used to perform some pre-installation tasks such as copying files to the C:\ drive, performing some variable replacement in config files, and executing applications for installing databases. We have run into an issue with trying to write to the config files, hence the install fails as the variables never get replaced. The environment is a hardened environment where only an administrator can install, so the script uses the #RequireAdmin directive. The original developer performed a FileRead, then performed a string replace on the variable name, then performed a FileDelete, and finally a FileWrite. Example:

$FindText1 = "@ROOT@"

$ReplaceText1 = $DomainName

$FileContents = FileRead($TextFileName)

$FileContents = StringReplace($FileContents,$FindText1,$ReplaceText1)

FileDelete($TextFileName)

FileWrite($TextFileName,$FileContents)

My concern is that somehow the administrative privileges are not propagating to these function calls, so when executed they do not have admin privileges. Has anyone experienced an issue like this or has suggestions on the most efficient way to perform this particular type of task?

Share this post


Link to post
Share on other sites



It's not an issue with the administrative privileges not "propagating" to the functions, your account SID simply doesn't have the proper permission in the ACL (or something like that...).

Anyway, look into icacls.exe and takeown.exe and use them to allow write permission to the files individually.


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

Thanks for the tip. It actually had nothing to do with that at all, instead the files had been marked read-only.

Share this post


Link to post
Share on other sites

Ciao.


apps-odrive.pngdrive_app_badge.png box-logo.png new_logo.png MEGA_Logo.png

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