troubleshooting Question

Combine these two WSH scripts?

Avatar of Rich Rumble
Rich RumbleFlag for United States of America asked on
Visual Basic ClassicVB Script
18 Comments1 Solution3582 ViewsLast Modified:
I'd like to use WMI to query the shares on a pc, or array of pc's as in this script:
On Error Resume Next
arrComputers = Array("127.0.0.1")
For Each strComputer In arrComputers
   WScript.Echo
   WScript.Echo "=========================================="
   WScript.Echo "Computer: " & strComputer
   WScript.Echo "=========================================="

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
   Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Share Where Type = 0 ")

I'd also like to get the permissions for each item it returns with the script here:
http://www.microsoft.com/technet/scriptcenter/scripts/security/dacls/sedcvb02.mspx
I've been trying to set the first line in this script to:
strFolderName = objItem.Path (rather than strFolderName = "C:\scripts\sec_center")
But it hasn't worked. Also using just the path won't really work on a remote pc share, as c:\something\something is not a valid share name.
perhaps strFolderName = strComputer\objItem.Name (not that that is a valid statement, but it should get the idea accross)
I'll probably need a for each... in there, anyone have any ideas? Should I post this to a different TA?
-rich
ASKER CERTIFIED SOLUTION
Chris Dent
PowerShell Developer
Join our community to see this answer!
Unlock 1 Answer and 18 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros