Jump to content
Sign in to follow this  

Directory/Folder operations

Recommended Posts


I am trying to find a way to script a solution to resetting ownership on folder and their files/folders below in a Windows 2003 environment. I am surprised not to find some of this functionality in AutoIT.


Share this post

Link to post
Share on other sites

Not my field, but does the stuff in Net Share management udf do what you want it to?


Share this post

Link to post
Share on other sites

Try this (WMI version):

;Coded by UEZ 2010
$objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\.\root\cimv2")

$file = FileOpenDialog("Select file to reset ownership from current user.", "", "(*.*)")
If @error Then Exit

Func Set_OwnerShip($file)
    $file = StringReplace($file, "\", "\\")
    Local $colItems, $colItem
    $colItems = $objWMIService.ExecQuery("Select * From CIM_DataFile Where Name = '" & $file & "'", "WQL", 0x30)
    If IsObj($colItems) Then
        For $objItem In $colItems
        Return SetError(0)
        Return SetError(1)



Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.