Quantcast
Channel: VMware Communities : All Content - VMware PowerCLI
Viewing all articles
Browse latest Browse all 16717

Select-Object output to a variable

$
0
0

Hello,

 

anytime I fill a variable with the output of a calculated property and then I use that variable later on in a script, instead of simply getting the value of the variable I also get @{} around it. Is there a way to avoid that? This is one line for instance:

 

$path2 = Get-VM $vm.VM | %{$_.Extensiondata.LayoutEx.File | where {$_.Name -like "*.vmsd"}} | select @{N="Path2";E={(($_.Name).ToString()).Split('[]')[1] }}

 

If I run the one liner it works. But if I use the $path2 variable somewhere else I get it wrapped as a hash table. Do I have to force text manipulation each time?


Viewing all articles
Browse latest Browse all 16717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>