I have a need to update file share resource path settings and I can do it via cluster.exe in a batch file I wrote (Pasted below) however what I have found is if I export a list of shares from the Server Managment MMC It gives me the share names and paths to the shares and I modify this to use with my script. What I found is that in a Cluster File Share resource there is a Share name then there is the name you give the resource. When performing an update of the resource using Cluster.exe it finds the resource by the Resource name and not the share name so if someone created a share called MyFileShare but named the resource "MyCluster File Share" you will not be able to update the file share resource based on the share name but only on the file share resource name.
How can I export a list of File Share resources with the Resource name, Share name and Share Path? Please help.
I have pasted my batch file so that it may help others with updating cluster resources:
:: Filename: CLU_Shares.cmd
:: Author : Mike Carmody EDS ~ Wintel-8
:: This batch file requires a file of the shares to
:: process in a quoted comma delimted format.
:: Example of the sharelist.txt
:: "Sharename","Path to the share","Remarks","Dependancy"
:: Example of the sharelist.txt
:: "30_DAYS","D:\SHAREROOTS\FDYSHR\30_DAYS","Temp storage for file less than 30 days old","Drive 1"
:: "412CP","D:\SHAREROOTS\FDYSHR\NATURAL\412CP","412CP Scanned file storage","Drive 1"
:: Not all comma delimted fields are required as long
:: as the comma is there.
@echo off
cls
Echo.
Echo This will Create or Update Cluster Shares from the
Echo list of shares in the sharelist.txt file.
Echo.
pause
:: This reads in each line of the sharelist.txt file and
:: processes the shares.
FOR /F "Tokens=1,2,3,4 delims=," %%i in (sharelist.txt) Do Call :RUN %%i %%j %%k
:RUN
IF %1=="" goto Error
:: Remove the :: to use a line it is basically the
:: same as REM.
:: Create a new share based on information in
:: the sharelist.txt file.
::CLUSTER.EXE . res %1 /create /group:"HOUSHR603" /type:"File Share"
::----------------------------------------------
:: Takes the share offline
CLUSTER.EXE . res %1 /Off
::----------------------------------------------
:: Sets the path if provided as the second field in the
:: comma quoted delimited file.
:: CLUSTER.EXE . res %1 /priv path=%2
::----------------------------------------------
:: Share name you are working with. %1 (the first item
:: in each line) provided from the sharelist.txt file
:: Use this to set the share name as the same as the
:: resource name.
CLUSTER.EXE . res %1 /priv Sharename=%1
::----------------------------------------------
:: Update the remarks section of the share.
:: CLUSTER.EXE . res %1 /priv Remark=%3
::----------------------------------------------
:: Updates the Description of the share. Uses the second
:: field from the sharelist.txt file if provided,
:: we use the path to make it easy to see from the
:: Cluster administrator program.
:: CLUSTER.EXE . res %1 /prop Description=%2
::----------------------------------------------
:: Turns on or off the Share Subdirectories for
:: this share. Useful when setting users shares.
:: Off = 0
:: on = 1
:: CLUSTER.EXE . res %1 /priv ShareSubDirs=0
::----------------------------------------------
:: Add dependancies to the resource.
:: You can add more than one line.
:: You can add more than one line if you have the same
:: dependancies to add you can hard code it in the batch
:: file too.
CLUSTER.EXE . res %1 /AddDep:"%4"
::----------------------------------------------
:: Remove dependancies to the resource.
:: You can add more than one line if you have the same
:: dependancies to remove you can hard code it in the batch
:: file too.
:: CLUSTER.EXE . res %1 /RemoveDependency:"D Drive"
::----------------------------------------------
:: This sets the Advanced tab options to Restart
:: and Affect the group for failover.
:: Make sure that restart is not set in addvanced tab.
:: 0 = Do Not Restart
:: 1 = Restart
:: 2 = Restart and Affect the Group
CLUSTER.EXE . res %1 /Prop RestartAction=1
::----------------------------------------------
:: Add Security to the Share if different from the default
:: CLUSTER.EXE . res %1 /priv security=Everyone,grant,C,Everyone,grant,R,Administrators,grant,f:security
::----------------------------------------------
:: Turns the Cluster Share Resource back on
CLUSTER.EXE . res %1 /On
goto End
:Error
Echo No More shares listed in the sharelist.txt file
:End
How can I export a list of File Share resources with the Resource name, Share name and Share Path? Please help.
I have pasted my batch file so that it may help others with updating cluster resources:
:: Filename: CLU_Shares.cmd
:: Author : Mike Carmody EDS ~ Wintel-8
:: This batch file requires a file of the shares to
:: process in a quoted comma delimted format.
:: Example of the sharelist.txt
:: "Sharename","Path to the share","Remarks","Dependancy"
:: Example of the sharelist.txt
:: "30_DAYS","D:\SHAREROOTS\FDYSHR\30_DAYS","Temp storage for file less than 30 days old","Drive 1"
:: "412CP","D:\SHAREROOTS\FDYSHR\NATURAL\412CP","412CP Scanned file storage","Drive 1"
:: Not all comma delimted fields are required as long
:: as the comma is there.
@echo off
cls
Echo.
Echo This will Create or Update Cluster Shares from the
Echo list of shares in the sharelist.txt file.
Echo.
pause
:: This reads in each line of the sharelist.txt file and
:: processes the shares.
FOR /F "Tokens=1,2,3,4 delims=," %%i in (sharelist.txt) Do Call :RUN %%i %%j %%k
:RUN
IF %1=="" goto Error
:: Remove the :: to use a line it is basically the
:: same as REM.
:: Create a new share based on information in
:: the sharelist.txt file.
::CLUSTER.EXE . res %1 /create /group:"HOUSHR603" /type:"File Share"
::----------------------------------------------
:: Takes the share offline
CLUSTER.EXE . res %1 /Off
::----------------------------------------------
:: Sets the path if provided as the second field in the
:: comma quoted delimited file.
:: CLUSTER.EXE . res %1 /priv path=%2
::----------------------------------------------
:: Share name you are working with. %1 (the first item
:: in each line) provided from the sharelist.txt file
:: Use this to set the share name as the same as the
:: resource name.
CLUSTER.EXE . res %1 /priv Sharename=%1
::----------------------------------------------
:: Update the remarks section of the share.
:: CLUSTER.EXE . res %1 /priv Remark=%3
::----------------------------------------------
:: Updates the Description of the share. Uses the second
:: field from the sharelist.txt file if provided,
:: we use the path to make it easy to see from the
:: Cluster administrator program.
:: CLUSTER.EXE . res %1 /prop Description=%2
::----------------------------------------------
:: Turns on or off the Share Subdirectories for
:: this share. Useful when setting users shares.
:: Off = 0
:: on = 1
:: CLUSTER.EXE . res %1 /priv ShareSubDirs=0
::----------------------------------------------
:: Add dependancies to the resource.
:: You can add more than one line.
:: You can add more than one line if you have the same
:: dependancies to add you can hard code it in the batch
:: file too.
CLUSTER.EXE . res %1 /AddDep:"%4"
::----------------------------------------------
:: Remove dependancies to the resource.
:: You can add more than one line if you have the same
:: dependancies to remove you can hard code it in the batch
:: file too.
:: CLUSTER.EXE . res %1 /RemoveDependency:"D Drive"
::----------------------------------------------
:: This sets the Advanced tab options to Restart
:: and Affect the group for failover.
:: Make sure that restart is not set in addvanced tab.
:: 0 = Do Not Restart
:: 1 = Restart
:: 2 = Restart and Affect the Group
CLUSTER.EXE . res %1 /Prop RestartAction=1
::----------------------------------------------
:: Add Security to the Share if different from the default
:: CLUSTER.EXE . res %1 /priv security=Everyone,grant,C,Everyone,grant,R,Administrators,grant,f:security
::----------------------------------------------
:: Turns the Cluster Share Resource back on
CLUSTER.EXE . res %1 /On
goto End
:Error
Echo No More shares listed in the sharelist.txt file
:End