Powershell array values, concatenating data -


this kind of painful question ask, here goes. i'm creating powershell script report on filer shares on netapp. i've gotten point can create report of shares, want take array i've created csv output , extract sharename value. want append in front of value servername "\filer\" creates unc path.

i'm intending @ unc , use generate information on filer shares. ntfs permissions, path info, etc etc..

here's code:

$sharelist = import-csv z:\shares.csv foreach ($item in $sharelist) { $sharelist += $item | add-member -name "filer" -value "\\<filername>\" -membertype noteproperty } 

this creating array , adding new property array match unc info...

i run select object clean output:

$sharelist | select-object mountpoint,filer,sharename,description | export-csv z:\sharereport.csv -notypeinformation 

this produces new csv that's nice , organized when open in excel.

however want take objects "filer" , "sharename" , put them produce unc path such:

\\<filername>\<sharepath> 

i thought perhaps use foreach loop follows:

foreach ($object in $sharelist.sharename) { $object -replace $object,"\\<filer>\" + $object } 

however doesn't work... assume there's got few different wants this, i'd appreciate guidance on this. simple problem powershell woefully poor (although getting better).

also, i'm getting information on shares using netapp powershell toolkit generate original sharelist array.

thanks everyone.

try join-path...

foreach ($object in $sharelist) {     join-path \\<filer>\ $object } 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -