MichaelBalack
asked on
How to get to know the shared folder share/ntfs permissions by using vbscript?
This is another vbs script to find out the local computer for any shared folder. Please see the script contents,
strComputer = "."
Set objSWbemLocator = CreateObject("WbemScriptin g.SWbemLoc ator")
Set objWMIService= objSWbemLocator.ConnectSer ver(".", "root\cimv2")
Set colShares = objWMIService.ExecQuery("S elect * from Win32_Share Where Type=0")
For each objShare in colShares
Wscript.Echo "Name: " & objShare.Name & vbCrLf _
& "Path: " & objShare.Path & vbCrLf _
& "Type: " & objShare.Type & vbCrLf _
& "Allow Maximum: " & objShare.AllowMaximum & vbCrLf _
& "Maximum Allowed: " & objShare.MaximumAllowed & vbCrLf _
& "Caption: " & objShare.Caption
Wscript.Echo "------------------------- --------"
Next
Using this script, I manage to get the list of shared folders. How about if I want to know the share/ntfs permissions of the shared folder, what should be added into the script?
Thanks in advance
strComputer = "."
Set objSWbemLocator = CreateObject("WbemScriptin
Set objWMIService= objSWbemLocator.ConnectSer
Set colShares = objWMIService.ExecQuery("S
For each objShare in colShares
Wscript.Echo "Name: " & objShare.Name & vbCrLf _
& "Path: " & objShare.Path & vbCrLf _
& "Type: " & objShare.Type & vbCrLf _
& "Allow Maximum: " & objShare.AllowMaximum & vbCrLf _
& "Maximum Allowed: " & objShare.MaximumAllowed & vbCrLf _
& "Caption: " & objShare.Caption
Wscript.Echo "-------------------------
Next
Using this script, I manage to get the list of shared folders. How about if I want to know the share/ntfs permissions of the shared folder, what should be added into the script?
Thanks in advance
ASKER
Hi Shaun,
Besides SetACL, can we use icacls? We do not allowed to use 3rd party tools according to company IT policy.
Besides SetACL, can we use icacls? We do not allowed to use 3rd party tools according to company IT policy.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for expert - Shaun, that's works
Use SetACL to export the NTFS permissions. It can also do the share permissions
https://helgeklein.com/setacl/