Shyam_Dhawale
Contributor
Contributor

Create InventoryMapping using SRM API

Jump to solution

I am using SRM 5.8, wanted to use new API feature to create folder, network mapping using powercli.

$web01 = New-WebServiceProxy("http://" + $srmServerAddr + ":9085/srm.wsdl") -Namespace SRM01

$srm01 = New-Object SRM01.Srmbinding

$srm01.url = "https://" + $srmServerAddr + ":9007"

$srm01.CookieContainer = New-Object System.Net.CookieContainer

$mof01 = New-Object SRM01.ManagedObjectReference

$mof01.type = "SrmServiceInstance"

$mof01.value = $mof01.type

$srmApi01 = ($srm01.RetrieveContent($mof01)).srmApi

$protection01 = ($srm01.RetrieveContent($mof01)).protection

$recovery01 = ($srm01.RetrieveContent($mof01)).recovery

$mapping = ($srm01.RetrieveContent($mof01)).InventoryMapping

PowerCLI C:\> $srm01.AddFolderMapping

OverloadDefinitions

-------------------

void AddFolderMapping(SRM01.ManagedObjectReference _this, SRM01.ManagedObjectReference primaryFolder, SRM01.ManagedObjectReference secondaryFolder)

I checked all the options to find primaryFolder MoRef but does not find any, can some point to how to map the folder using PowerCLI?

Regards,

Shyam Dhawale

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
Shyam_Dhawale
Contributor
Contributor

finally i am able to fix the issue, creating new object and adding folder moref on new object value.

#Primary Folder MoRef Value

  $PrFldrValue = ((Get-Folder -Server $PrimaryVC -Name $PrimaryFolder).ExtensionData.MoRef).Value

  $DrFldrValue = ((Get-Folder -Server $SecondaryVC -Name $SecondaryFolder).ExtensionData.MoRef).Value

#Create new object for adding primary folder value

  $PrFldrMoRef = New-Object SRM01.ManagedObjectReference

  #Add primary folder moref to object

  $PrFldrMoRef.Value = $PrFldrValue

  #

  #Create new object for adding secondary folder value

  $DrFldrMoRef = New-Object SRM01.ManagedObjectReference

  #Add primary folder moref to object

  $DrFldrMoRef.Value = $DrFldrValue

   $srm01.AddFolderMapping($mapping,$PrFldrMoRef,$DrFldrMoRef) # created folder mapping

Shyam Dhawale.

View solution in original post

0 Kudos
2 Replies
Shyam_Dhawale
Contributor
Contributor

finally i am able to fix the issue, creating new object and adding folder moref on new object value.

#Primary Folder MoRef Value

  $PrFldrValue = ((Get-Folder -Server $PrimaryVC -Name $PrimaryFolder).ExtensionData.MoRef).Value

  $DrFldrValue = ((Get-Folder -Server $SecondaryVC -Name $SecondaryFolder).ExtensionData.MoRef).Value

#Create new object for adding primary folder value

  $PrFldrMoRef = New-Object SRM01.ManagedObjectReference

  #Add primary folder moref to object

  $PrFldrMoRef.Value = $PrFldrValue

  #

  #Create new object for adding secondary folder value

  $DrFldrMoRef = New-Object SRM01.ManagedObjectReference

  #Add primary folder moref to object

  $DrFldrMoRef.Value = $DrFldrValue

   $srm01.AddFolderMapping($mapping,$PrFldrMoRef,$DrFldrMoRef) # created folder mapping

Shyam Dhawale.

View solution in original post

0 Kudos
ikiris
Enthusiast
Enthusiast

‌hhave you been able to access the addfoldermapping function via connect-srmserver cmdlet?

-Chris- http://www.twitter.com/ikiris http://blog.chrischua.net
0 Kudos