Avatar of MichaelBalack
MichaelBalackFlag for Singapore

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("WbemScripting.SWbemLocator")
Set objWMIService= objSWbemLocator.ConnectServer(".", "root\cimv2")
 
Set colShares = objWMIService.ExecQuery("Select * 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
* file sharingVB ScriptScripting Languages

Avatar of undefined
Last Comment
MichaelBalack
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

VBScript is not appropriate for this

Use SetACL to export the NTFS permissions. It can also do the share permissions
https://helgeklein.com/setacl/
Avatar of MichaelBalack
MichaelBalack
Flag of Singapore image

ASKER

Hi Shaun,

Besides SetACL, can we use icacls? We do not allowed to use 3rd party tools according to company IT policy.
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of MichaelBalack
MichaelBalack
Flag of Singapore image

ASKER

Thanks for expert - Shaun, that's works
VB Script
VB Script

VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.

39K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo