Aufgabe: Es sollen auf PCs vertrauenswürdige Sites per Powershell eingetragen werden, die für alle User auf dem PC gültig sind.
Problem: Eintrag wird auf HKLM:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains gemacht funktioniert es nicht.
Wird es nur für den Current User auf HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains ausgeführt, sind die Einträge da.
Bitte um Abhilfe
Powershell Script: Set-Location "HKLM:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" Set-Location ZoneMap New-Item Domains Set-Location Domains $myDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$xml = Get-Content "$MyDir\Office365-TrustedSites.xml" $ComputerRegPath = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains" $DWord = 2 #---------------------------------------------------------- #START FUNCTIONS #---------------------------------------------------------- Function CreateKeyReg { Param ( [string]$KeyPath, [string]$Name ) New-Item -Path "$KeyPath" -ItemType File -Name "$Name" -ErrorAction SilentlyContinue | Out-Null } #Function to set the Registry Values Function SetRegValue { Param ( [string]$RegPath ) Set-ItemProperty -Path $RegPath -Name "http" -Value $DWord -ErrorAction SilentlyContinue | Out-Null Set-ItemProperty -Path $RegPath -Name "https" -Value $DWord -ErrorAction SilentlyContinue | Out-Null } #---------------------------------------------------------- #START #---------------------------------------------------------- foreach( $entry in $xml.trusted) { [array]$Trusted = $entry.site } for($i = 0; $i -lt $Trusted.count; $i++) { [string]$PrimaryDomain = $Trusted[$i].Split('.')[1..10] -join '.' [string]$SubDomain = $Trusted[$i].Split('.')[0] CreateKeyReg -KeyPath $ComputerRegPath -Name $PrimaryDomain CreateKeyReg -KeyPath "$ComputerRegPath\$PrimaryDomain" -Name $SubDomain SetRegValue -RegPath "$ComputerRegPath\$PrimaryDomain\$SubDomain" -DWord $DWord }
Beispiel XML:
In dem Fall XML Namen genommen: Office365-TrustedSites.xml
<trusted> <site>*.aadrm.com</site> <site>*.activedirectory.windowsazure.com</site> <site>*.adhybridhealth.azure.com</site>
</trusted> Nach dem die Script mit Trusted Sites (XML) ausgeführt wird, funktioniert alles im Editor. Einträge sind dann auch in der Registry. Wenn ich dann im IE überprüfe, ob es übernommen wurde sehe ich nichts. Was kann ich dagegen tun ? Oder wie müsste das Script aussehen um diese Aufgabe zu überwältigen.
Ist vielleicht Registry Eintragsstelle falsch ? Oder muss noch ein Schlüssel angepasst werden ? Sowas wie HKLM_security_only auf 0 , hat nix gebracht leider?
Bin jetzt seit 2 Tagen dran und komme nicht weiter. Kann mir jemand bei der Lösung helfen ? Danke euch . Lg