Hi guys,
So, I’m trying to train my Powershell skils, I’m new to scripting and I’ve tried to do a simple script of managing VM’s (things like, show all the VM’s stop, suspend etc)
I’ve already tried few variations on the code, and i’m probably missing something, the thing is, that i dont understand what
here is the code (it is very simple code)
do
{
$input = Read-Host " what do you want to do?
`n1) list all the Vms
`n2) do something to the Vms?
`n
`n * what is your choice?"
switch ($input)
{
'1' { 'you choose to list all the avalibale VMs on the pc'
$mypcs = "localhost"
get-vm -computername $mypcs
}
'2' {
cls
'You chose option #2'
}
'3' {
cls
'You chose option #3'
}
'q' {
return
}
}
pause
}
until ($input -eq 'q')
I’ve tried to replace the
$mypcs = "localhost"
get-vm -computername $mypcs
with
get-vm
wihtout any variable, but still i’m getting errors
Missing closing '}' in statement block or type definition. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingEndCurlyBrace
PS: please don’t solve the problem, if you could, please direct me to the solution.
Thanks A lot, i’ve tried to search for a solution on google, but maybe i define the problem incorrectly so i dont get any correct answer.
thanks alot.