need to create a disk spaces pool remotely on a 2012 server

by willbs at 2013-04-29 14:56:25

if i try to create a spaces pool locally on a 2012 server, the code looks like this and it works

New-StoragePool -FriendlyName POOL1 -StorageSubSystemFriendlyName ‘Storage Spaces on RED-23’ -PhysicalDisks “PhysicalDisk1"

if i try to do it remotely with this code

invoke-command -scriptblock {
New-StoragePool -FriendlyName POOL1 -StorageSubSystemFriendlyName ‘Storage Spaces on RED-23’ -PhysicalDisks “PhysicalDisk1”
} -computername $global:uutName -credential $global:Credential

i get this response

Invalid class
+ CategoryInfo : MetadataError: (MSFT_StorageSub…1d4c2b00d489}”):ROOT/Microsoft/…torageSubSystem) [New-StoragePool], CimException
+ FullyQualifiedErrorId : HRESULT 0x80041010,New-StoragePool
+ PSComputerName : RED-23

any ideas why it won’t work

if i create a pool locally, i can delete/remove the pool remotely
by willbs at 2013-04-30 14:12:25
for some reason the remote command shown above wouldn’t work so what i did was write a ps script, copy it to the server, then execute it remotely

contents of the script, CreatePool.ps1

$PhysicalDisks = Get-PhysicalDisk -CanPool $True
$PhysicalDisks1 = Get-PhysicalDisk -FriendlyName $PhysicalDisks.friendlyname[0]
$PhysicalDisks2 = Get-PhysicalDisk -FriendlyName $PhysicalDisks.friendlyname[1]
$storagesubsys = get-storagesubsystem
New-StoragePool -FriendlyName POOL1 -StorageSubSystemFriendlyName $storagesubsys.FriendlyName -PhysicalDisks $PhysicalDisks1, $PhysicalDisks2

and i executed the local script remotely with this command

# create a storage pool with 2 drives
invoke-command -scriptblock {
Invoke-Expression -command C:\serverfolders\users\CreatePool.ps1
} -computername $global:uutName -credential $global:Credential

i had to do the same thing when i added a disk(s) to the pool