Hi!!
Need some help with a script I am trying to put together.
I can't seem to get the script to work like I want it to.
This is a small part of the script so far....
$domain = read-host "What domain? (A1, A2, B1, B2, C1 or C2)"
$role = read-host "What role? (AP, DC, EX or DB)"
get-vm -name $domain $Role *
So, if the domain input is A1, and the role is AP - I want the script to list all server named "A1APxxxxxx"
Just like:
get-vm -Name A1AP*
Then, to put a small twist in there... I would like it to filter out all servers with "W" after the $role parameter.
Like this:
get-vm -Name A1APW*
I guess I could put the "W" in as a variable - which could extend my script for linux/unix-servers too...
$os = read-host "What OS? (W for Windows, L for Linux, U for Unix)
But since I am not a linux admin, I don't care.
Can anyone please give me a pointer?