Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Map server name from cluster share resource

Status
Not open for further replies.

cluM09

Technical User
May 15, 2004
127
0
0
US
Hello,

The file server for the network shares of my company is a member of the MS cluster. There are three servers in the cluster.

I need to get the server name from the hiden shares from the the cluster resource. Since any of the three servers can be the active cluster node, I need to query the server name from the shares instead of pointing to a certain server as the file server name.

I have a way to determine the active node (server name) of the cluster resource for the shares, but I need to query the server name with WMI since I need to use an alternate credential when I query the server from the share.

I know that the Win32_ShareToDirectory class of the WMI can return the server name with either of the two properties: Share and SharedElement.

The script code below maps the network share to a local folder name.

Is there any way to modify the code so that I can get the server name from the share instead?

strShare = "MyShare"

strComputer = "CLUSTER_RESOURCE_NAME"

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colShares = objWMIService.ExecQuery _
("Associators of {Win32_Share.Name='" & strShare & "'} Where " _
& "AssocClass=Win32_ShareToDirectory")

For Each objFolder in colShares
Wscript.Echo objFolder.Name
Next


 
I don't have access to a cluster to work with, but I would suggest that you first download a copy of WMITOOLS from Microsoft. That will give you CIMStudio which makes browsing the WMI repository easy.

Take a look at using the MSCLuster namespace instead of using CIMV2. That may expose what you are looking for.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
markdmac,

Thank you for the response. I will check into the mscluster namespace and the MSCluster_Node class.

CluM09
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top