Quantcast
Channel: THWACK: Discussion List - All Communities
Viewing all articles
Browse latest Browse all 16365

Exporting Items to CSV via SWIS

$
0
0

Hi Folks,

I want to export Data to a CSV to compare this Data with another import CSV.

 

I already have the "wrapping" around but I can not export the Data. Is there any Powershell-Expert out there to help?

 

#Load SWIS Snapin
if (!(Get-PSSnapin | where {$_.Name -eq "SwisSnapin"})) {    Add-PSSnapin "SwisSnapin"
}
# CSV definition
$ExportFile = 'D:\_NCM_Scripts\Import\ExprtNCM.csv'
#Define Solarwinds System
$hostname = "localhost"
$username = "admin"
$password = "admin"
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
#Connect to the System
$target = Connect-Swis -v2 -Credential $cred -Hostname $hostname
#Get all URIs of Nodes in the System
$UriBasket = Get-SwisData $target "SELECT Uri FROM Orion.Nodes"
#Loop through all URIs and get Node Properties
foreach($UriEntry in $UriBasket){    $CustomProps = $UriEntry+'/CustomProperties'    $NodeProps = Get-SwisObject $target $UriEntry  $NodeCustomProps = Get-SwisObject $target $CustomProps
write-host $NodeProps.Caption
}

 

I would like to get $NodeProps.Caption etc into a CSV File, I can already access them by the Variables..I just don't know how to build my CSV File in Powershell.

As you can see I can already access the Data I want in the write-host statement

 

Thanks for any help


Viewing all articles
Browse latest Browse all 16365

Trending Articles



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