Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

use array contents to form varialbe

$
0
0

I am writing a change vmware ip script.  The command fails if you pass two variables and one is null(so i used arrays to count) and will pass the exact config for each server for dns ans wins.  when i set $dns it fails every time unless i manually set the value to the 192.168.3,19.168.4 listed below it works.  I want to pass $dnsarray[0] and [1] to look just like the 192.168 example above.  Something isn't right with the formattting it fails every time and im sure it is just quotes and or apostrophes.

Example that fails: -dns $DNS = $DNSArray[0] + "," + $DNSArray[1

Example that works: -dns 192.168.1.3,192.168.5

I just want to pass the array contents in a string that in the end will look just like the 192.168 line.  It just isn't working and i have checked it is a string so im out of ideas. 

 

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles