/build/static/layout/Breadcrumb_cap_w.png

Problems retrieving txt file.

Hello,

 I have a script that place the results into a folder on the c drive. I have other scripts that work, but this one does not show me anything in a custom field.

This is the command I'm using in software inventory: ShellCommandTextReturn(cmd /c type c:\KBOX\monitors.txt).

This is the Script:

$(function Decode {
    If ($args[0] -is [System.Array]) {
        [System.Text.Encoding]::ASCII.GetString($args[0])
    }
    Else {
        "Not Found"
    }
}


ForEach ($Monitor in Get-WmiObject WmiMonitorID -Namespace root\wmi) { 
    $Name = Decode $Monitor.UserFriendlyName -notmatch 0
    $Serial = Decode $Monitor.SerialNumberID -notmatch 0
    $Manufacturer = Decode $Monitor.ManufacturerName -notmatch 0
    $User = $Monitor.PSComputerName
 
    echo "$Name,$Serial"
}
)*>&1 > C:\kbox\monitors.txt.

above is what the kbox\monitor.txt file looks like.



2 Comments   [ + ] Show comments
  • So the monitors.txt file is being created correctly but the CIR doesn't contain that information? Does the CIR not show up in a device'es inventory or does it report some value? Does your CIR have all relevant OSes selected? - JasonEgg 6 years ago
    • it may one show one line - Kdebiasse 6 years ago
      • odd, I have some CIRs using 'type' and are able to return txt files with multiple lines. I don't know what might be wrong :-/ - JasonEgg 6 years ago
  • above is the software inventory and what the text file looks like. It's not pulling in the data. - Kdebiasse 6 years ago

Answers (0)

Be the first to answer this question

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ