vmware-archive / powernsx

PowerShell module that abstracts the VMware NSX-v API to a set of easily used PowerShell functions
173 stars 89 forks source link

Cannot add servicegroupmember to service group #536

Closed Crypto-Gi closed 6 years ago

Crypto-Gi commented 6 years ago

Plz let me know how we could add service or servicegroup to service group . I've tried different combinations of cmdlts but it does not works.

Get-NsxServiceGroup TEST-GROUP-2 | Add-NsxServiceGroupMember -Member "TEST-1234" Get-NsxServiceGroup TEST-GROUP-2 | Add-NsxServiceGroupMember -Member $TEST-1234 Get-NsxServiceGroup TEST-GROUP-2 | Add-NsxServiceGroupMember -Member TEST-1234

servicegroupmember111

alagoutte commented 6 years ago

it will check but you need to use get "member" before

$TEST-1234 = Get-NsxService

and after Get-NsxServiceGroup Test-Group-2 | Add-nsxServiceGroupMember -Member $TEST-1234

Crypto-Gi commented 6 years ago

☹ not working image

Crypto-Gi commented 6 years ago

PS C:\Users> Get-NsxServiceGroup TEST-GROUP-2

objectId : applicationgroup-9a5c270c-6230-4ea1-a02f-2e05c1e152ab objectTypeName : ApplicationGroup vsmUuid : 564DE042-0851-C5AB-19E8-C86063B3644B nodeId : 26fb786f-6d42-43f3-83b2-062fd0891aa3 revision : 1 type : type name : TEST-GROUP-2 description : TEST GROUP scope : scope clientHandle : extendedAttributes : isUniversal : true universalRevision : 0 inheritanceAllowed : false

PS C:\Usersr> Get-NsxService TEST1234

objectId : application-823e409a-5bb5-4d72-bae1-cfb21306c107 objectTypeName : Application vsmUuid : 564DE042-0851-C5AB-19E8-C86063B3644B nodeId : 26fb786f-6d42-43f3-83b2-062fd0891aa3 revision : 2 type : type name : TEST1234 description : TEST SERVICE scope : scope clientHandle : extendedAttributes : isUniversal : true universalRevision : 1 inheritanceAllowed : false element : element

PS C:\Users\r> Get-NsxServiceGroup TEST-GROUP-2 | Add-NsxServiceGroupMember -Member $TEST1234 invoke-nsxwebrequest : Invoke-NsxWebRequest : The NSX API response received indicates a failure. 400 : Bad Request : Response Body: <?xml version="1.0" encoding="UTF-8"?>

Requested member application-1 is not a valid member for addition to Security Group applicationgroup-9a 5c270c-6230-4ea1-a02f-2e05c1e152ab.
301core-services

At C:\Users\CSLTMir\Documents\WindowsPowerShell\Modules\PowerNSX\PowerNSX.psm1:26662 char:21

invoke-nsxwebrequest : Invoke-NsxWebRequest : The NSX API response received indicates a failure. 400 : Bad Request : Response Body: <?xml version="1.0" encoding="UTF-8"?>

Requested member application-5 is not a valid member for addition to Security Group applicationgroup-9a 5c270c-6230-4ea1-a02f-2e05c1e152ab.
301core-services

At C:\Users\CSLTMir\Documents\WindowsPowerShell\Modules\PowerNSX\PowerNSX.psm1:26662 char:21

invoke-nsxwebrequest : Invoke-NsxWebRequest : The NSX API response received indicates a failure. 400 : Bad Request : Response Body: <?xml version="1.0" encoding="UTF-8"?>

Requested member application-6 is not a valid member for addition to Security Group applicationgroup-9a 5c270c-6230-4ea1-a02f-2e05c1e152ab.
301core-services

At C:\Users\CSLTMir\Documents\WindowsPowerShell\Modules\PowerNSX\PowerNSX.psm1:26662 char:21

nmbradford commented 6 years ago

see #533 - you should not use variable names that contain dashes. . Also - from your screenshot before, it looks as if you are trying to add a local service to a universal servicegroup which (as the error says) isnt supported.

Crypto-Gi commented 6 years ago

How can I add multiple variables

$service = get-nsxservice test-1234 , test-3 , test4 or $service = get-nsxservice test-1234 test-3 test4