Most of my UCS powershell scripts relies on custom functions that would be too much and haven't been tested enough to post here. I am in the process of trying to reformat them to utilize the UCS cmdlets. Here is a section of code that I have used and works. It inputs from a CSV that has headers; Servers,ChassisID,BladeID. Servers is the name of the service profile, the other two are self explanatory...I hope. I utilize the Get-Org cmdlet to save having to input the DN myself incase it was a sub-sub-organization. Note here, I tried using Get-Org with just an org name and the -recursive option and it didn't return anything. Not sure why so I still have to play with but I have only had these for a couple days.
A comment on Joshua's code. I don't think that will work because he doesn't have all the extra quotations escaped with another set of quotes. So to take just a bit of that line the first quote starts the string but then to the cmdlet that string stops after the first equal sign and no is a separate item and so on. Again this is an assumption and I haven't tested it but from my understanding that line won't work as you would think. I would suggest something like my line below where each quote inside the XML is escaped with another quote. Just food for thought as we begin to explore the use of Invoke-Xmlcommand.
1
2###### INPUT files ######
3# $Servers CSV should have headers for Server,ChassisID,BladeID
4$Servers = Import-Csv -Path "./inputs/STC21717UCS201.csv"
5$org = Get-Org -Org "root/ORGNAME"
6foreach ($server in $Servers)
7{
8 $xmlcmd = "<configConfMos cookie=""$($CurrentUCSMInstance.Cookie)"" inHierarchical=""false""><inConfigs><pair key=""$($org.dn)/""><lsServer dn=""$($org.dn)/ls-$($server.server)""><lsBinding pnDn=""sys/chassis-$($server.chassisID)/blade-$($server.BladeID)"" /></lsServer></pair></inConfigs></configConfMos>"
9 Invoke-XmlCommand -XMLStringList $xmlcmd
10}