Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
December 26, 2005
Using RMTShare.exe, I have scripted DelimShares.bat to output the share information of a specified computer is semi-colon (;) delimited format, like:
"ShareName";"Path";"Remarks";"Maximum Number Users";"Current Number Users";"User1:Perm1";"User2:Perm2";"UserN:PermN"
Here is a partial sample"
"\jsi001C$";"C:";"Default share";"No limit";"0""\jsi001NETLOGON";"C:WINDOWSsysvolsysvolJSIINC.ORGSCRIPTS";"Logon server share";"No limit";"0";"Everyone:READ";"BUILTINAdministrators:FULL CONTROL""\jsi001HP2250";"HP Business Inkjet 2250 (PCL5C),LocalsplOnly";"Fastest";"No limit";"0";"BUILTINAdministrators:FULL CONTROL";"UserX:PermX"
The syntax for using DelimShares.bat is:
DelimShares \ComputerName
Where \ComputerName is a remote or local computer name.
DelimShares.bat contains:
@echo offsetlocal ENABLEDELAYEDEXPANSIONif {%1}=={} goto errset comp=%1if "%comp:~0,2%" NEQ "\" goto errset f1=find /v "The command completed successfully."set f2=findstr /v /b /c:"Share name"set f3=find /v "--------------"set f4=find /v "No permissions specified."set f5=find /v "Permissions:"for /f "Tokens=1" %%a in ('rmtshare %comp%^|%f1%^|%f2%^|%f3%') do ( set shr=%%a call :sharename)endlocalgoto :EOF:sharenameset perm=for /F "Tokens=*" %%s in ('rmtshare %comp%%shr% ^|%f1%^|%f4%^|%f5%') do ( set work=%%s set work=!work:;=,! if "!work:~0,18!" EQU "Share name " set sn="!work:~18!"&set work=NONE if "!work:~0,4!" EQU "Path" set pth="!work:~18!"&set work=NONE if "!work:~0,6!" EQU "Remark" set rmk="!work:~18!"&set rmk=!rmk:;=,!&set work=NONE if "!work:~0,18!" EQU "Maximum users " set mu="!work:~18!"&set work=NONE if "!work:~0,18!" EQU "Users " set nu="!work:~18!"&set work=NONE if "!work!" NEQ "NONE" set work=!work: =! if "!work!" NEQ "NONE" set work=!work: :=:! if "!work!" NEQ "NONE" set work=!work:: =:! if "!work!" NEQ "NONE" set perm=!perm!;"!work!")@echo %sn%;%pth%;%rmk%;%mu%;%nu%%perm%goto :EOF:err@echo DelimShares \ComputerNameendlocal
You May Also Like