General Discussion

PowerShell windows share creation automation



Please, could anyone share an example PowerShell command syntax or script snip on how to automate creating CIFS shares for CDOT?  We need to migrate 2008 user's shares to new FAS, but the problem we have more than a 1000 old users that still have hidden user shares and must be preserved, (dont' ask, its a requirement :)).  Data migration is done via robocopy and we have .csv with users name folder path on netapp and appropriate usershare$. It would nice to automate the process when the script reads the input file line by line and creates a corresponding share$ with everyone access permission for it.  I would greatly appreciate for the example.

Thanks a lot in advance.

PS. Yes, we know about netapp home share feature, but right now its a matter of exact data migration, same way as it was, so need those shares on netapp. 

PS2. If someone has a script based on "cifs share create -vserver" command and an example of how to apply to SVM, this would work too.  Thanks!


Re: PowerShell windows share creation automation


Hi Folks,

to update my post, we "cooked" a ps script using Netapp Powershell kit  for each share with this syntax:

Add-NcCifsShare -Name UserShare$ -path '/vol_name/qtree_name/users/Userpath' -ShareProperties @("browsable","oplocks","show_previous_versions")


Some pre-massaging in Excel for columns and path modification and Notepadd++ to remove extra tabs and spaces were required.  But it did the job reasonably quick and for each runaway, an error will point to the line number in the script,  so its easy to track down a specific path to fix.  Hope it will help someone else as well. Cheers!

View solution in original post

Re: PowerShell windows share creation automation


Hi,  How can I see the original solution? I cant seem to open the link.

Earn Rewards for Your Review!
GPI Review Banner
All Community Forums