Question to PowerShell

This topic contains 3 replies, has 3 voices, and was last updated by  Joel Sallow 3 weeks ago.

  • Author
    Posts
  • #97731

    Martins
    Participant

    Hi all,

    I have one issue, i build this code in powershell

    gwmi win32_computersystem | Select-Object -Property Devicename,Driverversion, Manufacturer, Model
    gwmi Win32_PnPSignedDriver | select Devicename,Driverversion, Manufacturer | where {$_.DeviceName -like "*Bios*"}
    gwmi Win32_PnPSignedDriver | select Devicename,Driverversion, Manufacturer | where {$_.DeviceName -like "*Wireless*"}
    gwmi Win32_PnPSignedDriver | select Devicename,Driverversion, Manufacturer | where {$_.DeviceName -like "*HD Graphics*"}
    gwmi Win32_PnPSignedDriver | select Devicename,Driverversion, Manufacturer | where {$_.DeviceName -like "*Realtek High*"}
    gwmi Win32_PnPSignedDriver | select Devicename,Driverversion, Manufacturer | where {$_.DeviceName -like "*Ethernet*"}
    gwmi Win32_PnPSignedDriver | select Devicename,Driverversion, Manufacturer | where {$_.DeviceName -like "*Camera*"}
    gwmi Win32_PnPSignedDriver | select Devicename,Driverversion, Manufacturer | where {$_.DeviceName -like "*Sierra*"}

    and my issue is when i try convert this all information to .CSV the file is all black can you help me for resolved my issue?
    The objective is catch all this information and put in sharepoint it's possible or not?

  • #97740

    Chris Bakker
    Participant

    "Tis should get you going

     gwmi Win32_PnPSignedDriver | select Devicename,Driverversion, Manufacturer | where {
     $_.DeviceName -like "*Bios*" -or
     $_.DeviceName -like "*Wireless*" -or
     $_.DeviceName -like "*HD Graphics*" -or
     $_.DeviceName -like "*Realtek High*" -or
     $_.DeviceName -like "*Ethernet*" -or
     $_.DeviceName -like "*Camera*" -or
     $_.DeviceName -like "*Sierra*" }| export-csv g:\test.csv
    
    • #97743

      Martins
      Participant

      Thanks that's works :D.
      Can you tell me if when i export this information to csv i can put online in sharepoint automatically?

  • #97768

    Joel Sallow
    Participant

    You can shorten the above with a bit of regex:

     Get-WmiObject -Class Win32_PnPSignedDriver | Select-Object Devicename, Driverversion, Manufacturer | 
        Where-Object {
            $_.DeviceName -match "Bios|Wireless|HD Graphics|Realtek High|Ethernet|Camera|Sierra" 
        } | Export-Csv -Path 'g:\test.csv'

You must be logged in to reply to this topic.