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.
-
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