- Community Home
- >
- Storage
- >
- HPE Nimble Storage
- >
- Array Setup and Networking
- >
- Powershell Script to Create Clone, Mount Clone
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2013 03:22 AM
07-22-2013 03:22 AM
G'Morning,
Does anyone have a script or point me in the right direction for the following script/tool.
## Microsoft OS requirement ##
- Select a Volume Snap
- Create a Clone
- Mount Snap
With NetApp's Snapdrive - it is posisble to select a snapshot of a LUN and mount that at another drive letter.
I know this is all possible manually, just very tedious task when trying to restore data.
If not I'll work on it myself
Thanks
Sparkles
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2013 08:22 AM
07-22-2013 08:22 AM
Solutionjrich523/NimblePowerShell · GitHub
whatever it doesnt do for you, let me know and i'll add it in.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2013 01:38 AM
07-23-2013 01:38 AM
Re: Powershell - create clone, mount clone
Awesome, thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2013 11:49 AM
07-24-2013 11:49 AM
Re: Powershell - create clone, mount clone
Hi Justin, is there any documentation about what those scripts do and how to use them? Thanks. I'm looking for something similar as Mike asked but I'm no expert on power shell scripting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2013 12:03 PM
07-24-2013 12:03 PM
Re: Powershell - create clone, mount clone
Sorry I have not had time to populate the docs. I've tried to create all of the functions in a very standard way.
If you tell me what you're trying to do i could provide the code you'd use.
Also I should in the next week or so have time to get back on top of this, I need to add "volume collections" and populate the docs and then i'll have the majority of the gui functionality implemented.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2013 12:17 PM
07-24-2013 12:17 PM
Re: Powershell - create clone, mount clone
Jason - there is a rather excellent introduction tutorial here
Many of the things Justin is using in his rather excellent scripts is also covered in that tutorial.
Hope this helps
Rich
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2013 12:18 PM
07-24-2013 12:18 PM
Re: Powershell - create clone, mount clone
basically I'm looking for scripts to make restoring data easier. Just like Mike said, clone a volume from a snapshot, give access permission of that volume to a server, connect to the volume using iSCSI in the server. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2013 01:01 PM
07-24-2013 01:01 PM
Re: Powershell - create clone, mount clone
Those are all in the module, have you loaded it successfully?
You have to connect first, but you can get a list of all functions by running the following command.
gcm -Module nimble
That will return about 18 functions. the names are pretty self explanatory..
You can use tab to help complete things, for example if you do
get-nsvolume -<tab>
You can then tab through the different parameters.
I would suggest using powershell ISE to start since the intellisense will really help.
This was created in powershell 3 but should be compatible with 2, however i strongly suggest you use v3.
I've tried to add a good deal of protection to any remove command, but, like anything else, be careful with what you do.
in your case, are you talking about taking a snapshot that you have already and converting it in to a close and setting access? Is the snapshot from a protection plan?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2013 05:46 AM
07-25-2013 05:46 AM
Re: Powershell - create clone, mount clone
Hi Justin, I tried the gcm –Module nimble command and it returns nothing. I copied all the scripts into my powershell profile and the folder is named nimble. I’m running Windows 8 which is powershell version 4. Does that matter? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2013 08:16 AM
07-25-2013 08:16 AM
Re: Powershell - create clone, mount clone
so you'll want to copy all of the files (and unblock them) to
my documents\windowspowershell\modules\nimble
dump all the files in that folder and then from powershell type
import-module nimble
gcm -module nimble
also, V4 is currently only with Windows 2012 R2 and as a CTP download. however if you do have it, it will work fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2013 08:20 AM
07-25-2013 08:20 AM
Re: Powershell - create clone, mount clone
I did try the import command and here’s what I got:
Import-Module : Could not load file or assembly
'file:///C:\Users\admin\Documents\WindowsPowerShell\Modules\nimble\GroupMgmt.dll' or one of its dependencies. Operation
is not supported. (Exception from HRESULT: 0x80131515)
At line:1 char:1
+ Import-Module nimble
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ( , FileLoadException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2013 08:26 AM
07-25-2013 08:26 AM
Re: Powershell - create clone, mount clone
this is from the Win8 box?
if you type in $host what do you get? It should say its V3. if its V2 then its possible that the groupmgmt.dll might be compiled for .net 4.0 and since powershell V2 is .net 2.0 that might cause an issue.
also did you unblock the files? that might also cause it
you can do, in V3
gci "$(split-path $profile)\modules\nimble" -r | Unblock-File
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2013 08:29 AM
07-25-2013 08:29 AM
Re: Powershell - create clone, mount clone
That was on a Windows server 2012 datacenter which has version 3. I confirmed it by running get-host command. The files have been unblocked too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2013 08:52 AM
07-25-2013 08:52 AM
Re: Powershell - create clone, mount clone
One thing I noticed is you said groupmgmt.dll might be compiled for .net 4.0 but I only have 4.5 on my Windows 8 and Windows server 2012. That might causing the issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2013 09:26 AM
07-25-2013 09:26 AM
Re: Powershell - create clone, mount clone
try doing this, go to the folder that contains the files (nimble folder) and type this
add-type -Path .\GroupMgmt.dll
also, im not sure if this matters,but do you run it elevated? i have mine set to by default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2013 10:11 AM
07-25-2013 10:11 AM
Re: Powershell - create clone, mount clone
Thanks Justin. Running add-type command fixed the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2013 10:12 AM
07-25-2013 10:12 AM
Re: Powershell - create clone, mount clone
Thats kind of odd since essentially thats what the import-module is doing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2013 05:16 AM
07-26-2013 05:16 AM
Re: Powershell - create clone, mount clone
I did stumble across this yesterday - after getting wound up using disk part, new PS modules should be able to cover the requirements for disk part when mounting a clone.
I'll be looking into this in a week or so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2013 08:24 AM
07-26-2013 08:24 AM
Re: Powershell - create clone, mount clone
yeah 2012 is awesome with its cmdlets... we're making a push to get to 2012 for this reason. however you can feed stuff to diskpart fairly easily..
$id = gwmi win32_diskdrive -ComputerName $ComputerName -Credential $Credential -Filter "model LIKE 'vmware%'" | sort @{e={(($_.size /1gb) / $size)%1}},index -Descending |select -first 1 -exp index
$dpscript = @"
select disk $id
online disk noerr
convert gpt noerr
create partition primary noerr
assign letter=$letter
FORMAT FS=NTFS UNIT=64k QUICK Label=SQL
"@
$job = Invoke-Command -ScriptBlock {$args[0] | diskpart} -Session $session -ArgumentList $dpscript
I use this as part of my Add-DriveToVm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2013 09:21 AM
07-26-2013 09:21 AM
Re: Powershell - create clone, mount clone
I've just got the following to work - (Remove "write-host" from the "foreach" line **or leave in to see what its going to do **):
### get Nimble disks ###
$nimbledisks = get-disk | Where {$_.Manufacturer -like "Nimble*"} | select -expandproperty "number"
### Remove readonly ###
write-host "remove readonly atribute from disks > $nimbledisks" -foregroundcolor yellow
foreach( $disk in $nimbledisks ){ write-host set-disk -number $disk -isreadonly 0}
write-host "Disks > $nimbledisks -> writeable" -foregroundcolor green
### Remove offline ###
write-host "remove offline atribute from disks > $nimbledisks" -foregroundcolor yellow
foreach( $disk in $nimbledisks ){ write-host set-disk -number $disk -isoffline 0}
write-host "Disks > $nimbledisks -> online" -foregroundcolor green
Next I need to work out assigning drive letters, holiday first though
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2013 09:31 AM
07-26-2013 09:31 AM
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2013 09:54 AM
07-28-2013 09:54 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2013 07:57 AM
07-29-2013 07:57 AM
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 ☺
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2013 07:59 AM
07-29-2013 07:59 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2013 02:19 PM
07-29-2013 02:19 PM
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.