MattTheEmp
MattTheEmp

Reputation: 1

PowerShell: how to use PSWarranty

I am trying to find the start date one a bunch of HP machines.

this ps should be helpful but i cannot find how to pass in the csv

i am trying

update-warrantyinfo -CSV

But then do now know how to pass the file in

any help would be appreciated.

Thank you

Upvotes: 0

Views: 441

Answers (1)

mklement0
mklement0

Reputation: 440307

I'm assuming you're using the third-party PSWarranty module.

Daniel has provided the crucial pointer:

Update-WarrantyInfo -CSV -CSVFilePath c:\path\to\your\file.csv

That is - somewhat unusually - -CSV is just a switch (flag-like parameter) that selects CSV input, but the actual file path must be specified via a separate parameter, -CSVFilePath (which, curiously, isn't marked as mandatory).


How could you have discovered this information yourself?

While the module doesn't seem to come with help, PowerShell's help system can still provide syntax information:

Update-WarrantyInfo -? | oss | Select-String csv

Note: Update-WarrantyInfo -? is short for Get-Help Update-WarrantyInfo, and oss is a built-in wrapper function for Out-String -Stream, to stream the help text line by line.

Output (relevant parts highlighted):

    update-warrantyinfo -CSV [-CSVFilePath <string>] [-SyncWithSource] [-MissingOnly] [-OverwriteWarranty] [-LogActions] [-LogFile <string>] [-GenerateReports]
[-ReturnWarrantyObject] [-ExcludeApple] [-ReportsLocation <string>] [<CommonParameters>]

Another option:

# Prints details for all parameters whose names contain 'csv' (case-insensitively)
Get-Help Update-WarrantyInfo -Parameter *csv*

Output:

-CSV

    Required?                    true
    Position?                    Named
    Accept pipeline input?       false
    Parameter set name           CSV
    Aliases                      None
    Dynamic?                     false
    Accept wildcard characters?  false


-CSVFilePath <string>

    Required?                    false
    Position?                    Named
    Accept pipeline input?       false
    Parameter set name           CSV
    Aliases                      None
    Dynamic?                     false
    Accept wildcard characters?  false

Upvotes: 2

Related Questions