Hi folks, I am experimenting with the powershell and I wanted to set an owner on a bunch of disks.
I have about 12 disks I want to set owner to one of the controllers, so how I can put it in a script ?
should i use a text file and just include the disk ID's there, like 0c.89 and 1c.61 etc.... and then pass the file through the Set-NaDiskOwner cmdlet ?
5 REPLIES 5
Who owns them now?
Yes, the -Name parameter expects a string. You could create an array and pipe that to set-nadiskowner. It's possible to be a bit more creative as well depending on what you're trying to do. Get-nadiskowner returns objects that include a -Name property, a string, which is the name of the disk. On set-nadiskowner, the -Name parameter accpts pipeling input bypropertyname...
Let's say that I add a new shelf and want to assign all the disks to a specific controller, controller1:
get-nadiskowner -OwnershipType unowned | set-nadiskowner -Controller $controller1
Or perhaps I have a shelf that came from another controller and have now attached it to controller1 and wish to take ownership of all the disks with unknown ownership and assign them to controller1:
get-nadiskowner -OwnershipType Unknown | set-nadiskowner -Controller $controller1
Hello, Anton. You can specify the disks in various ways, including using wildcards:
All disks: Get-NaDisk | Set-NaDiskOwner $controllerName
One disk: Get-NaDisk 0c.89 | Set-NaDiskOwner $controllerName
All disks on a channel: Get-NaDisk 0c.* | Set-NaDiskOwner $controllerName
Multiple specific disks: Get-NaDisk 0c.89 1c.61 | Set-NaDiskOwner $controllerName
Unowned disks: Get-NaDiskOwner -OwnershipType unowned | Set-NaDiskOwner $controllerName
As you suggest, you could also create a text file with disk names, import that into a string array, and pipe the array into Get-NaDisk.
(I am not in front of my NetApp at this time )
What would be equal to this command?
disk assign -n 8
Would this work?
Get-NADisk | Select -First 8 | Set-NaDiskOwner $controllerName
I don't want to assign all of the disks in this case.