1.    13 Jan 2010 #1
    Russell Guest

    Format-Table output ?


    Hello,

    In the script below how do I output the $objItem.Name and
    $objItem.DriverName
    using Format-Table instead of write-host or do I need to somehow use both?

    Thanks.


    $strComputer = "."

    $colItems = get-wmiobject -class "Win32_Printer" -namespace
    "root\CIMV2" -computername $strComputer

    foreach ($objItem in $colItems)
    {
    write-host $objItem.Name $objItem.DriverName
    write-host
    }

      My System SpecsSystem Spec

  2.    13 Jan 2010 #2
    PaulChavez Guest

    RE: Format-Table output ?


    Try this:

    get-wmiobject -class "Win32_Printer" | format-table Name,DriverName

    Localhost and roo\CimV2 are defaults for get-wmiobject.

    "Russell" wrote:

    > Hello,
    >
    > In the script below how do I output the $objItem.Name and
    > $objItem.DriverName
    > using Format-Table instead of write-host or do I need to somehow use both?
    >
    > Thanks.
    >
    >
    > $strComputer = "."
    >
    > $colItems = get-wmiobject -class "Win32_Printer" -namespace
    > "root\CIMV2" -computername $strComputer
    >
    > foreach ($objItem in $colItems)
    > {
    > write-host $objItem.Name $objItem.DriverName
    > write-host
    > }
    >
      My System SpecsSystem Spec

  3.    13 Jan 2010 #3
    Russell Guest

    Re: Format-Table output ?


    Thank you. That's what I was looking for.


    "PaulChavez" <PaulChavez@newsgroup> wrote in message
    news:4B3D05E9-E81F-4079-909C-37A475A1CD9B@newsgroup

    > Try this:
    >
    > get-wmiobject -class "Win32_Printer" | format-table Name,DriverName
    >
    > Localhost and roo\CimV2 are defaults for get-wmiobject.
    >
    > "Russell" wrote:
    >

    >> Hello,
    >>
    >> In the script below how do I output the $objItem.Name and
    >> $objItem.DriverName
    >> using Format-Table instead of write-host or do I need to somehow use
    >> both?
    >>
    >> Thanks.
    >>
    >>
    >> $strComputer = "."
    >>
    >> $colItems = get-wmiobject -class "Win32_Printer" -namespace
    >> "root\CIMV2" -computername $strComputer
    >>
    >> foreach ($objItem in $colItems)
    >> {
    >> write-host $objItem.Name $objItem.DriverName
    >> write-host
    >> }
    >>
      My System SpecsSystem Spec


Similar Threads
Thread Forum
-f format Format-Table Format-List against Select
For some reason I need to rename a column within a select Get-WmiObject win32_SystemEnclosure -ComputerName SD-IT003 it returns SerialNumber ...
PowerShell
Getting Powershell output into a sql table
As a Powershell newbie, i wanted to know if i can create a powershell app that will search my list of SQL Server Instances (from a sql table) query...
PowerShell
RE: How to convert Table-Format Data to CSV-Format?
Prevous version needed fine tuning --did it in a hurry. Now it split lines even when the value part is null and removes the dash from property...
PowerShell
RE: How to convert Table-Format Data to CSV-Format?
# change this line switch -r (gc <AV Log File's path here>) { # to: switch -r -file <AV Log File's path here> { # better way to read huge...
PowerShell
RE: How to convert Table-Format Data to CSV-Format?
Try this: $out = @() switch -r (gc <AV Log File's path here>) { '^Date:' { $obj = new-object psObject } '^+' { $prop, $val =...
PowerShell
[demo] Format-Chart - Formats output as a table with a chart colum
The script formats output as a table with a pseudo-graphical chart column calculated for the last specified numeric property. It is here:...
PowerShell
Trying to use the output as a table
I am not having alot of luck creating a table type object from the output of a file. I can force it into a table and export it to a file as csv...
PowerShell

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • PC Help Forum
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 06:36.
    .