![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | A array problem in this little command i want to access a element of a array: please look for ($a=0; $a -le 8; $a++) {dsadd group "CN=$hn$b[$a],OU=local,OU=roles,DC=cz,DC=int-e,DC=kaufland" -scope l The output of the defined variable $hn is ok, but when i want to access $b[$a] variable, the array will output his whole content. Do I have to mascerade my $b variable? Any help is welcome? THX |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: A array problem try this "CN=$($hn)$($b[$a]),OU=local,OU=roles,DC=cz,DC=int-e,DC=kaufland" The "$( )" Expands the result of $b[$a] and outputs the string instead. "Jens Diekers" <Jens Diekers@discussions.microsoft.com> wrote in message news:2E8F00FF-EFD5-4874-982A-6635B4CC585F@microsoft.com... > in this little command i want to access a element of a array: please look > > for ($a=0; $a -le 8; $a++) {dsadd group > "CN=$hn$b[$a],OU=local,OU=roles,DC=cz,DC=int-e,DC=kaufland" -scope l > > The output of the defined variable $hn is ok, but when i want to access > $b[$a] variable, the array will output his whole content. Do I have to > mascerade my $b variable? > > Any help is welcome? > THX |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: A array problem Jens Diekers wrote: > in this little command i want to access a element of a array: please look > > for ($a=0; $a -le 8; $a++) {dsadd group > "CN=$hn$b[$a],OU=local,OU=roles,DC=cz,DC=int-e,DC=kaufland" -scope l > > The output of the defined variable $hn is ok, but when i want to access > $b[$a] variable, the array will output his whole content. Do I have to > mascerade my $b variable? > > Any help is welcome? > THX It could be $b is a string or something else other than an array. Before doing your loop, what does "$b.gettype()" give? Marco ------------------ PowerGadgets MVP http://www.powergadgets.com/mvp |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: A array problem p.s. Also... Im not entirely sure what your goal is by $a -le 8, but if you just want to do it for each element in $b foreach($element in $b) { "CN=$hn$element,OU=local,OU=roles,DC=cz,DC=int-e,DC=kaufland" -scope l } "Jens Diekers" <Jens Diekers@discussions.microsoft.com> wrote in message news:2E8F00FF-EFD5-4874-982A-6635B4CC585F@microsoft.com... > in this little command i want to access a element of a array: please look > > for ($a=0; $a -le 8; $a++) {dsadd group > "CN=$hn$b[$a],OU=local,OU=roles,DC=cz,DC=int-e,DC=kaufland" -scope l > > The output of the defined variable $hn is ok, but when i want to access > $b[$a] variable, the array will output his whole content. Do I have to > mascerade my $b variable? > > Any help is welcome? > THX |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: A array problem Thank you Brandon and Marco! This Solutions is very effective for my PS Script. I hope I can help you next time. P.S. Marco: the b variable returns marketcodes... Great Support... |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Fast copy method of sub array (=array range) possible? | VB Script | |||
| How to create array without quotes? $array = (a,b,c) | PowerShell | |||
| Array indexing: Want to say "Item #2 through the rest of the array." | PowerShell | |||
| Stupid Array Tricks: Initializing an Array to a Certain Size | PowerShell | |||
| how to assign values to array and how to create array via variable | PowerShell | |||