Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 168455

Re: Convert string back to system object when importing from CSV

$
0
0

Thanks for the reply I really appreciate it.

 

Your reply got me thinking. I don't know whether it matters if its a system.object or not, aren't they both arrays?

 

I have simplified what I am trying to do, by removing the full function, to its bare minimum. I **think** I need to somehow make the AllowedIPAddresses an array rather than string. this is basically what I am struggling with

 

 

 

$SrcFWFile = 'c:\temp\Rules.csv'

 

$Srcdata = import-csv -path $SrcFWFile  

# $Srcdata  | Select-Object Ruleset, AllowedIPAddresses , Enabled

 

 

 

 

 

 

    $Srcdata = import-csv -path $SrcFWFile

foreach ($currentsetting in $Srcdata) {

    if($Srcdata -ne $null){

        $Srcfwenabled = $Srcdata  | Where-Object { $_.Ruleset -eq $CurrentSetting.Ruleset }  | Select-Object Ruleset, Enabled

        $SrcfwIpList = $Srcdata | Where-Object { $_.Ruleset -eq $CurrentSetting.Ruleset }  | Select-Object Ruleset, AllowedIPAddresses

    }

    $type = $SrcfwIpList.AllowedIPAddresses

    $SrcfwIpList.Ruleset, $type.GetType().Name, $SrcfwIpList.AllowedIPAddresses

}

 


Viewing all articles
Browse latest Browse all 168455

Trending Articles



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