Kann mir mal sagen warum das Skript nicht mehr funktioniert?
Moin,
folgendes Skript hat mal einen brauchbaren CSV Output gebracht.
Jetzt erhalte ich nur noch die Meldung.
Was ist da los?
Skript ist das hier
folgendes Skript hat mal einen brauchbaren CSV Output gebracht.
Jetzt erhalte ich nur noch die Meldung.
Was ist da los?
Ausnahme beim Aufrufen von "GetStringValue": "Der Parameter ist ungültig. "
In C:\Identifziere_IE_Version_LDAP.ps1:21 Zeichen:5
+ $iePath = ($regProv.GetStringValue($HKLM, $IESubKeyName, "")).sValue
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) , MethodInvocationException
+ FullyQualifiedErrorId : WMIMethodException
Skript ist das hier
function Get-IEVersion {
param(
[String] $computerName
)
# Create custom object.
$outputObject = "" | Select-Object `
@{Name="ComputerName"; Expression={$computerName}},
@{Name="Path"; Expression={}},
@{Name="Version"; Expression={}},
@{Name="Error"; Expression={}}
# Step 1: Read App Paths subkey to get path of iexplore.exe.
try {
$regProv = [WMIClass] "\\$computerName\root\default:StdRegProv"
}
catch [System.Management.Automation.RuntimeException] {
# Update custom object with error message and return it.
$outputObject.Error = $_.Exception.InnerException.InnerException.Message
return $outputObject
}
$iePath = ($regProv.GetStringValue($HKLM, $IESubKeyName, "")).sValue
if ( -not $iePath ) {
# Update custom object with error message and return it.
return $outputObject
}
$outputObject.Path = $iePath
# Replace '\' with '\\' when specifying CIM_DataFile key path.
$iePath = $iePath -replace '\\', '\\'
# Step 2: Get the CIM_DataFile instance of iexplore.exe.
try {
$dataFile = [WMI] "\\$computerName\root\CIMV2:CIM_DataFile.Name='$iePath'"
# Update custom object with IE file version.
$outputObject.Version = $dataFile.Version
}
catch [System.Management.Automation.RuntimeException] {
# Update custom object with error message.
$outputObject.Error = $_.Exception.InnerException.InnerException.Message
}
# Return the custom object.
return $outputObject
}
$computers= Get-ADComputer -Filter "Name -like 'server*'" -Properties * | Where-Object OperatingSystem -Like '*server*' | Select-Object -expandProperty Name
#$computers= Get-ADComputer -Filter "Name -like '*'" -Properties * | Where-Object OperatingSystem -Like '*Server*' | Select-Object -expandProperty Name
$temp = $null
foreach ( $computer in $Computers ) {
#Get-IEVersion $computer
$temp +=,(Get-IEVersion $computer)
}
$temp | Out-GridView
$path = $temp | Export-Csv -Delimiter ';' -NoTypeInformation -Force -Path "W:\IEVersionen1.csv"
Please also mark the comments that contributed to the solution of the article
Content-Key: 306405
Url: https://administrator.de/contentid/306405
Printed on: April 26, 2024 at 13:04 o'clock
6 Comments
Latest comment
Weil die Variablen
$HKLM
und
$IESubKeyName
in der Zeile:
$regProv.GetStringValue($HKLM, $IESubKeyName, "")
nirgendwo definiert sind :-P Da hat einer was vergessen...Copy n'paste ist wohl doch nicht immer die beste Wahl
https://msdn.microsoft.com/de-de/library/aa390788%28v=vs.85%29.aspx
https://gallery.technet.microsoft.com/scriptcenter/Servers-Inventory-rep ...
Gruß skybird
$HKLM
und
$IESubKeyName
in der Zeile:
$regProv.GetStringValue($HKLM, $IESubKeyName, "")
nirgendwo definiert sind :-P Da hat einer was vergessen...Copy n'paste ist wohl doch nicht immer die beste Wahl
https://msdn.microsoft.com/de-de/library/aa390788%28v=vs.85%29.aspx
https://gallery.technet.microsoft.com/scriptcenter/Servers-Inventory-rep ...
Gruß skybird