Azure PowerShell cmdlet into Strings -


just quick question. running lines of code like,

$publicip = get-content (get-azurevm -servicename $servicename -name $vmsname | get-azureendpoint | select { $._vip }) $osdisk = get-content (get-azurevm -servicename $servicename -name $vmsname | get-azureosdisk) 

and me ipaddress or variables, when trying put value csv cell, fails. think because tries add labels, not know how string , set variable that. know how remedy this?

edit:

if output with:

get-azurevm -servicename "vm1" -name "vm1" | select dnsname | out-string 

is this:

dnsname                                                                                                                      -------                                                                                                                      http://example.cloudapp.net/ 

how put in "http://example.cloudapp.net/" csv-entry? right trying put of code block csv giving me awful formatting erros.

select alias select-object , allows take 1 or more properties object , creates new object them.

if want expand property value, use -expandproperty parameter:

get-azurevm -servicename "vm1" -name "vm1" | select -expandproperty dnsname  

should give http://example.cloudapp.net/

also, when want send data csv, can pipe objects cmdlet export-csv use property names headers , objects in array rows , properties columns.

example:

get-childitem -file | select name, size | export-csv c:\temp\filelist.csv 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -