Array Setup and Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

Powershell Script to Create Clone, Mount Clone

 
SOLVED
Go to solution
Highlighted
Trusted Contributor

Re: Powershell - create clone, mount clone

for 2012 here is what i do, this will grab all "raw" disks, meaning anything that isnt used. this does make an assumption of only a single raw disk, but as you've shown its fairly easy to foreach it.

$disk = get-disk  | ? partitionstyle -eq "RAW"

set-disk -InputObject $disk -IsOffline $false

set-disk -InputObject $disk -IsReadOnly $false

Initialize-Disk -InputObject $disk -PartitionStyle MBR

New-Partition -InputObject $disk -UseMaximumSize -DriveLetter $letter

Format-Volume -DriveLetter $letter -FileSystem NTFS -NewFileSystemLabel "data" -Confirm:$false

also, to find the next valid letter...

$volumes = gwmi win32_volume

$letters = $volumes | ? {$_.driveletter} |  select -exp driveletter | sort | %{$_.replace(":","")}

$letter = [string][char]([char]'C'..[char]'Z' | ? {[char]$_ -notin $letters} | select -first 1)

Highlighted
Trusted Contributor

Re: Powershell - create clone, mount clone

I noticed that Justin Rich is using the same GroupMgmt.dll that I made. I have a script that does something similar to the original request but for SQL servers. It could easily be modified to be used for any other such scenario. It also handles all the diskpart and chkdsk needs. I have a couple of customers that use this today for refreshing Dev/Test and reporting SQL servers.

https://dl.dropboxusercontent.com/u/17785549/nimbleScripts.zip

Highlighted
Frequent Advisor

Re: Powershell - create clone, mount clone

Hi Adam, thanks. those are very good scripts. I’ll see if I can customize them according to my need. I’ll probably spend some time on improving my PS script skill first ☺

Highlighted
Frequent Advisor

Re: Powershell - create clone, mount clone

Hi Justin, can you give me an example of the new-nsclone command? I couldn’t figure out how to use it. Thanks.

Highlighted
Trusted Contributor

Re: Powershell - create clone, mount clone

Looks like i havent fully implemented that part yet. let me take a look and see if i can get it going easily.

Highlighted
Occasional Advisor

Re: Powershell - create clone, mount clone

I've got these scripts loaded into powershell but am having trouble connecting to the array. When I enter the following command:

Connect-NSArray -SystemName 10.10.10.10 -UserName Admin -Password password

I get an error: "Couldn't login to http://10.10.10.10:4219/soap"

Can you tell what I'm missing here.

Thanks!

Highlighted
Trusted Contributor

Re: Powershell - create clone, mount clone

so the username is case sensitive, its a lowercase a..

also you dont even need to provide that (its in case you've got other accounts setup, the default is provided)

Connect-NSArray -systemname 10.10.10.10 -password password

Highlighted
Occasional Advisor

Re: Powershell - create clone, mount clone

I'm getting back to this topic now. I still get a failure when I try to login. I'm using this command:

Connect-NSArray -systemname 10.10.10.10 -password mypass

and I get back the following error:

Couldn't login to http://10.10.10.10:4210/soap

Is there something that must be done to talk to the array on port 4210 or is it set by default?

Highlighted
Occasional Visitor

Re: Powershell - create clone, mount clone

I would like to know more about GroupMgmt.dll. Is this supplied by Nimble? An open source project?  Something else?

Thanks!

Highlighted
Occasional Advisor

Re: Powershell - create clone, mount clone

Did you ever get volume collections added to this module? Really want to create a snap/clone that is SQL consistent.

Thanks,

Mike