Hi,
When executing:
Add-ADGroupMember -Identity $textbox2.text -Members $ADObjectsToAdd
I get the following message:
>> Add-ADGroupMember -Identity testgroup -Members $ADObjectsToAdd
Cannot find an object with identity: 'test01, test02' under: 'DC=subdomain,DC=domain,DC=local'.
However, when I execute the command while debugging it works fine:
Add-ADGroupMember -Identity testgroup -Members user1,user2
$ADObjectsToAdd contains
user1,user2
$ADOBjectsToAdd.count shows only 1 item
$ADobjectsToAdd | gm shows system.string
Please advise howto debug.
J.
Cannot add-groupmember in PS Studio with variable
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Cannot add-groupmember in PS Studio with variable
That's exactly what I'm trying but I can't make it into one.
Tried
$ADObjectsToAdd = @()
$ADObjectsToAdd = $AddEmployeeForm_textboxnames
tried
[array]$ADObjectsToAdd += $AddEmployeeForm_textboxnames
but did not work
Tried
$ADObjectsToAdd = @()
$ADObjectsToAdd = $AddEmployeeForm_textboxnames
tried
[array]$ADObjectsToAdd += $AddEmployeeForm_textboxnames
but did not work
Re: Cannot add-groupmember in PS Studio with variable
Nice, that works indeed for a textbox multilined!
However, I need to have the values of a multilined textbox in a external form. That would be $EntriesIWantToGet = $AddEmployeeForm_textboxnames
There is no property lines for $AddEmployeeForm_textboxnames ...
However, I need to have the values of a multilined textbox in a external form. That would be $EntriesIWantToGet = $AddEmployeeForm_textboxnames
There is no property lines for $AddEmployeeForm_textboxnames ...
Re: Cannot add-groupmember in PS Studio with variable
Ok, I understand. Here an example of what I'm trying to do (att.).
- Attachments
-
- ADDADObjects.zip
- (277.13 KiB) Downloaded 103 times
Re: Cannot add-groupmember in PS Studio with variable
Hi,
Could you advise on howto get multilined variable back from another form?
My example shows it is working for single line textbox but not for a multilined textbox.
The variable in the other form does not have a property lines either.
Thanks for your feedback.
J.
Could you advise on howto get multilined variable back from another form?
My example shows it is working for single line textbox but not for a multilined textbox.
The variable in the other form does not have a property lines either.
Thanks for your feedback.
J.