Loading

Process

Skip Feed
  1. Snow XML import
    I am trying to import devices into snow using snow XML import. But the output that i get from the script shows only 1 device in the xml.  Here is the template & script that i have: Host;Domain;CompType;CompManufacturer;User;OS;SWManufacturer;SWName;Version COMP0001;AU;Notebook;HP;user1; User1;MS;MS Visio 2010;2010   ## Check for correct input parameters   if($args.Count -ne 3)   {   Write-Output "" "csv2snow.ps1" "" "Syntax:" ".\csv2snow.ps1 <path to input.csv> <output-path> <sitename>" "" "Example:" ".\csv2snow.ps1 D:\snowtemplate.csv D:\Device XML" ""   return   }   else   {   $report=$args[0]   $outputdir=$args[1]   $sitename=$args[2] ## Check that the input file exists, otherwise exit   if (!(test-path($report))) { write-host "Input file not found.";return } ## Check that the output directory exists, otherwise create it   if (test-path($outputdir)) { } else { mkdir $outputdir > $ } ## Import the report   write-host (get-date) "Importing file.."   $myinput = import-csv $report -Delimiter ";"   $totalrows = $myinput.Length   write-host "$totalrows rows found"   $current = 0   $currhost = $myinput[$current].host   write-host $currhost   $prods = @()   $now = get-date ## Go through all rows of the CSV   while ($current -lt $totalrows) { $h = $myinput[$current].host if($h -ne $currhost) { #process the old host, then start with the new data   write-host (get-date) "Processing host $currhost" ## Start writing the SnowXML for the host   $output_file = $outputdir + "\" + $currhost +'.xml' $XmlWriter = New-Object System.XMl.XmlTextWriter($output_file,$)   $xmlWriter.Formatting = [System.Xml.Formatting]::Indented   $xmlWriter.WriteStartDocument() $lastupdate = $now.ToString("yyyy-MM-ddThh:mm:ss") $xmlWriter.WriteStartElement("client")   $xmlWriter.WriteElementString('isdmisupported',"false")   $xmlWriter.WriteElementString('isapmsupported',"false")   $xmlWriter.WriteElementString('isplugandplay',"false")   $xmlWriter.WriteElementString('primarybustype',"false")   $xmlWriter.WriteElementString('secondarybustype',"false")   $xmlWriter.WriteElementString('hasusb',"false")   $xmlWriter.WriteElementString('biosreleasedate','1900-01-01T01:00:00')   $xmlWriter.WriteElementString('biosmanufacturer','(n/a)')   $xmlWriter.WriteElementString('biosserialnumber','(n/a)')   $xmlWriter.WriteElementString('biosversion','(n/a)')   $xmlWriter.WriteElementString('company',"false")   $xmlWriter.WriteElementString('dmiversion',"false")   $xmlWriter.WriteElementString('hasflashbios',"false")   $xmlWriter.WriteElementString('hostname',$currhost)   $xmlWriter.WriteElementString('isportable','false')   $xmlWriter.WriteElementString('lastupdate',$lastupdate)   $xmlWriter.WriteElementString('numberofprocessors','1')   $xmlWriter.WriteElementString('manufacturer','(n/a)')   $xmlWriter.WriteElementString('model','(n/a)')   $xmlWriter.WriteElementString('username','(n/a)')   $xmlWriter.WriteElementString('installdate',"1900-01-01T01:00:00")   $xmlWriter.WriteElementString('sitename',$sitename)   $xmlWriter.WriteElementString('clientidentifier',$currhost)   $xmlWriter.WriteElementString('clienttype',0)   $xmlWriter.WriteElementString('isvdi',"false") $xmlWriter.WriteStartElement("memory")   $xmlWriter.WriteElementString('freeslots',"0")   $xmlWriter.WriteElementString('freeswap',"0")   $xmlWriter.WriteElementString('maxphysical',"0")   $xmlWriter.WriteElementString('totalslots',"0")   $xmlWriter.WriteElementString('totalphysical',"0")   $xmlWriter.WriteElementString('totalvirtual',"0")   $xmlWriter.WriteElementString('freevirtual',"0")   $xmlWriter.WriteElementString('freephysical',"0")   $xmlWriter.WriteElementString('totalswap',"0")   $xmlWriter.WriteEndElement() ## Process the software for the host   foreach ($prod in $prods) { $xmlWriter.WriteStartElement("application")   $xmlWriter.WriteElementString('binarytype',"0")   $xmlWriter.WriteElementString('format',"0")   $xmlWriter.WriteElementString('installdate',"1900-01-01T12:00:00")   $xmlWriter.WriteElementString('name',$prod.SWName)   $xmlWriter.WriteElementString('islocal',"true")   $xmlWriter.WriteElementString('ismsi',"true")   $xmlWriter.WriteElementString('isshortcut',"false")   $xmlWriter.WriteElementString('processortype',"0")   $xmlWriter.WriteElementString('uninstallstring',"0")   $xmlWriter.WriteElementString('filename',"(n/a)")   $xmlWriter.WriteElementString('filepath',"(n/a)")   $xmlWriter.WriteElementString('filedatetime',"1900-01-01T12:00:00")   $xmlWriter.WriteElementString('filesize',0)   $xmlWriter.WriteElementString('version',"SNOWXML-" + $prod.SWVersion)   $xmlWriter.WriteElementString('manufacturer',"(n/a)")   $xmlWriter.WriteElementString('language',"Language Neutral")   $xmlWriter.WriteElementString('fullcappeakdate',"1900-01-01T12:00:00")   $xmlWriter.WriteElementString('isrecognized',"1")   $xmlWriter.WriteElementString('coresublimit',"0")   $xmlWriter.WriteElementString('issubcapacity',"false")   $xmlWriter.WriteElementString('subcappeakdate',"1900-01-01T12:00:00")   $xmlWriter.WriteElementString('pvusubcap',"0")   $xmlWriter.WriteElementString('ispvu',"false")   $xmlWriter.WriteElementString('coresubcap',"0")   $xmlWriter.WriteElementString('pvusublimit',"0")   $xmlWriter.WriteEndElement()   } $xmlWriter.WriteStartElement("networkadapter")   $xmlWriter.WriteElementString('dnsserver',"0")   $xmlWriter.WriteElementString('macaddress',"0")   $xmlWriter.WriteElementString('productname',"0")
    Expand Post

    1 of 2
    • Community Manager (Flexera Software)

      Hi Dheemant, We have discussed this earlier during our calls, but just to be sure, the PowerShell script will create 1 XML file for each device. Please do let me know if you need any assistance with this. Best Regards, Burak

  2. Snow XML import

    I am trying to import devices into snow using snow XML import. But the output that i get from the script shows only 1 device in the xml. 

     

    Here is the template & script that i have:

     

    Host;Domain;CompType;CompManufacturer;User;OS;SWManufacturer;SWName;Version COMP0001;AU;Notebook;HP;user1; User1;MS;MS Visio 2010;2010 

     

    ## Check for correct input parameters 

    if($args.Count -ne 3) 

    { Write-Output "" "csv2snow.ps1" "" "Syntax:" ".\csv2snow.ps1 <path to input.csv> <output-path> <sitename>" "" "Example:" ".\csv2snow.ps1 D:\snowtemplate.csv D:\Device XML" "" 

    return 

    } 

    else 

    { 

    $report=$args[0] 

    $outputdir=$args[1] 

    $sitename=$args[2]

     

    ## Check that the input file exists, otherwise exit 

    if (!(test-path($report))) { write-host "Input file not found.";return }

     

    ## Check that the output directory exists, otherwise create it if (test-path($outputdir)) { } else { mkdir $outputdir > $ }

     

    ## Import the report write-host (get-date) "Importing file.." $myinput = import-csv $report -Delimiter ";" $totalrows = $myinput.Length write-host "$totalrows rows found" $current = 0 $currhost = $myinput[$current].host write-host $currhost $prods = @() $now = get-date

     

    ## Go through all rows of the CSV while ($current -lt $totalrows) { $h = $myinput[$current].host if($h -ne $currhost) { #process the old host, then start with the new data write-host (get-date) "Processing host $currhost"

     

    ## Start writing the SnowXML for the host 

    $output_file = $outputdir + "\" + $currhost +'.xml'

    $XmlWriter = New-Object System.XMl.XmlTextWriter($output_file,$) 

    $xmlWriter.Formatting = [System.Xml.Formatting]::Indented 

    $xmlWriter.WriteStartDocument()

    $lastupdate = $now.ToString("yyyy-MM-ddThh:mm:ss")

     

    $xmlWriter.WriteStartElement("client") 

    $xmlWriter.WriteElementString('isdmisupported',"false") 

    $xmlWriter.WriteElementString('isapmsupported',"false") 

    $xmlWriter.WriteElementString('isplugandplay',"false") 

    $xmlWriter.WriteElementString('primarybustype',"false") 

    $xmlWriter.WriteElementString('secondarybustype',"false") 

    $xmlWriter.WriteElementString('hasusb',"false") 

    $xmlWriter.WriteElementString('biosreleasedate','1900-01-01T01:00:00') 

    $xmlWriter.WriteElementString('biosmanufacturer','(n/a)') 

    $xmlWriter.WriteElementString('biosserialnumber','(n/a)') 

    $xmlWriter.WriteElementString('biosversion','(n/a)') 

    $xmlWriter.WriteElementString('company',"false") 

    $xmlWriter.WriteElementString('dmiversion',"false") 

    $xmlWriter.WriteElementString('hasflashbios',"false") 

    $xmlWriter.WriteElementString('hostname',$currhost) 

    $xmlWriter.WriteElementString('isportable','false') 

    $xmlWriter.WriteElementString('lastupdate',$lastupdate) 

    $xmlWriter.WriteElementString('numberofprocessors','1') 

    $xmlWriter.WriteElementString('manufacturer','(n/a)') 

    $xmlWriter.WriteElementString('model','(n/a)') 

    $xmlWriter.WriteElementString('username','(n/a)') 

    $xmlWriter.WriteElementString('installdate',"1900-01-01T01:00:00") 

    $xmlWriter.WriteElementString('sitename',$sitename) 

    $xmlWriter.WriteElementString('clientidentifier',$currhost) 

    $xmlWriter.WriteElementString('clienttype',0) 

    $xmlWriter.WriteElementString('isvdi',"false") $xmlWriter.WriteStartElement("memory") 

    $xmlWriter.WriteElementString('freeslots',"0") 

    $xmlWriter.WriteElementString('freeswap',"0") 

    $xmlWriter.WriteElementString('maxphysical',"0") 

    $xmlWriter.WriteElementString('totalslots',"0") 

    $xmlWriter.WriteElementString('totalphysical',"0") 

    $xmlWriter.WriteElementString('totalvirtual',"0") 

    $xmlWriter.WriteElementString('freevirtual',"0") 

    $xmlWriter.WriteElementString('freephysical',"0") 

    $xmlWriter.WriteElementString('totalswap',"0") 

    $xmlWriter.WriteEndElement()

     

    ## Process the software for the host 

    foreach ($prod in $prods) { $xmlWriter.WriteStartElement("application") 

    $xmlWriter.WriteElementString('binarytype',"0") 

    $xmlWriter.WriteElementString('format',"0") 

    $xmlWriter.WriteElementString('installdate',"1900-01-01T12:00:00") 

    $xmlWriter.WriteElementString('name',$prod.SWName) 

    $xmlWriter.WriteElementString('islocal',"true") 

    $xmlWriter.WriteElementString('ismsi',"true") 

    $xmlWriter.WriteElementString('isshortcut',"false") 

    $xmlWriter.WriteElementString('processortype',"0") 

    $xmlWriter.WriteElementString('uninstallstring',"0") 

    $xmlWriter.WriteElementString('filename',"(n/a)") 

    $xmlWriter.WriteElementString('filepath',"(n/a)") 

    $xmlWriter.WriteElementString('filedatetime',"1900-01-01T12:00:00") 

    $xmlWriter.WriteElementString('filesize',0) 

    $xmlWriter.WriteElementString('version',"SNOWXML-" + $prod.SWVersion) 

    $xmlWriter.WriteElementString('manufacturer',"(n/a)") 

    $xmlWriter.WriteElementString('language',"Language Neutral") 

    $xmlWriter.WriteElementString('fullcappeakdate',"1900-01-01T12:00:00") 

    $xmlWriter.WriteElementString('isrecognized',"1") 

    $xmlWriter.WriteElementString('coresublimit',"0") 

    $xmlWriter.WriteElementString('issubcapacity',"false") 

    $xmlWriter.WriteElementString('subcappeakdate',"1900-01-01T12:00:00") 

    $xmlWriter.WriteElementString('pvusubcap',"0") 

    $xmlWriter.WriteElementString('ispvu',"false") 

    $xmlWriter.WriteElementString('coresubcap',"0") 

    $xmlWriter.WriteElementString('pvusublimit',"0") 

    $xmlWriter.WriteEndElement() }

    $xmlWriter.WriteStartElement("networkadapter") 

    $xmlWriter.WriteElementString('dnsserver',"0") 

    $xmlWriter.WriteElementString('macaddress',"0") 

    $xmlWriter.WriteElementString('productname',"0")

    Expand Post

    1 of 4
    • I am interested in something similar. The powershell script appears to be cut at the end - where can the csv2snow.ps1 be downloaded from fully?

  3. SCCM to SLM format details

    Hi all, can anyone pint me in the direction of the format i should use to create a CSV extract from SCCM to import into SLM. The SCCM instance is completely air-gapped so i can't use the SCCM connector via the SIM. I don't really want to dump the SCCM then restore it to a temp VM and then import. I also believe that someone may have created a script/tool that can convert CSV into xml so that i could try importing the details as xml via a SIM. 

    Initially want to test this as a small test, but then may want to do this on a more regular (6 monthly/monthly) basis.

    Anyone else have any suggestion?

    Thanks

    Expand Post

    1 of 5
    • Hi:

      I know this is an old thread, but it seems this is what I need in order to help a customer.

      I guess that with the migration of the community to the new system, the code has been cut in the middle.

      Is there any chance of getting the full code again?

       

      Thanks in advance

      Expand Post

End of Feed
End of Feed
3 Chatter Feed Items
ALL CONVERSATIONS
UNSOLVED
ARTICLES
3 Posts

Related Topics

    Loading
    Process | Flexera