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

2

1 Answer

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest