Microsoft Virtualization Discussions

PowerShell: Create volume, qtree, associate protection and efficiency policies

tyrone_owen_1
3,867 Views

Hi,

 

I want to create a PS script which:

 

1. Reads variables from an Excel

2. Creates a volume

3. Creates one to optinally multiple qtrees in the volume

4. Associates protection policy to volume

5. Associates efficiency policy to volume

6. Creates a share and assigns permissions on each of the qtrees created

 

I know very little about PS so is there anyone that can give me a starting point pls?

 

Thanks

4 REPLIES 4

JGPSHNTAP
3,852 Views

This is a community where we try to assist others, but we cannot completely write scripts for people, especially a complete script.  The 'user' needs to have some skin in the game for me.

 

I can get you started, but you have to put some effort in yourself

 

What your asking for is very easy to do in powershell and even easier to do with WFA

 

You want a csv file as an import with your header fields.

 

Start looking at get-nchelp or show-nchelp.

 

I will get you started with volume name

 

name junction  aggr  size 

vol1   /vol1         aggr1  10g

 

$vols - this will represent the above.

 

$vols = import-csv createvols.csv

 

$vols  | % {

new-ncvol -name $_.name  -aggregate $_.aggr "  -junctionpath $_.junction $_.size  -spacereserve "none" 

}

 

That's a for loop iterating thru your array.  

 

You can start with that.  Powershell is not intimidating once you get the basics..

 

 

 

 

tyrone_owen_1
3,841 Views

Thanks for the reply

 

I don't recall asking anyone to write the script for me though I'll obviously take one if it exists!

 

Unfortunately WFA means another VM on top of the OCUM and OCCM VMs so not possible.

 

Thanks again

JGPSHNTAP
3,832 Views

Sorry i read it fast and it came across as, please write these for me.

 

Depending how much you provision WFA might not be worth it, and you can do whatever you want in powershell

tyrone_owen_1
3,825 Views

No worries - thanks

Public