HI guys
we I add a security group to the VM local administrators group by using powerCLI, I would like to read the VM from a list .
Thanks
Ah, but that is different, you can't have anything on that line after @'
When you do that at the PS prompt, hit <enter> after @'
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Gurus
Trying to use Invoke-Vmscript and use @' '@ to create the string but it will not take it and give the error of "No character"
but if I use " ", it works correctly, can someone shed some light on why is that?
Thanks gurus
My crystal bol is out of service at the moment, can you show us some code to help us understand what you mean?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
L
If I do the following , the invoke-vmscript works fine
$code= "
add-localgroupMember -Group 'administrators' -Member 'SG'
"
but if I do with single quote or double quote
$code=@'
add-localgroupMember -Group 'administrators' -Member 'SG'
'@
I get the following error
"No characters are allowed after a here-string header but before the end of the line"
That 1st snippet is a regular string.
The 2nd snippet is a here-string, which can be done with single or double quotes.
Your here-string works perfectly for me.
Are you sure there are no (hidden) characters after @' ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
L.
hidden characters?, there is nothing I see plain eye.
Thanks
bad format but with @'
test
'@ the red ">" still there
Ah, but that is different, you can't have anything on that line after @'
When you do that at the PS prompt, hit <enter> after @'
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference