Das Active Setup Advanced ist eine verbesserte Möglichkeit, um Benutzerteile auszuführen.
Description | Microsoft Office Fix | Beschreibung der Software |
Command | "C:\Program Files\simplewall\ActiveSetup.vbs" | Kommando, der mit Benutzerrechten ausgeführt wird |
ReferenceFile | C:\Program Files\simplewall\simplewall.exe | Diese Datei muss existieren, damit der Command ausgeführt wird |
ReferenceReg | HKEY_LOCAL_MACHINE\SOFTWARE\SimpleWall | Dieser Registry Key muss existieren, damit der Command ausgeführt wird |
Type | install/uninstall | Der Command muss nach der Installation/Deinstallation ausgeführt werden |
# 1.0 Initial Version by Cluebiz # Copy this file to c:\Program Files\cluebiz\Active Setup Advanced\RunActivesetup.ps1 # Create a key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", name "Active Setup Advanced", value "c:\Program Files\cluebiz\Active Setup Advanced\RunActivesetup.ps1" $key = Get-ChildItem -path "HKLM:\SOFTWARE\Microsoft\Active Setup Advanced" foreach($mykey in $key) { $machineactivesetupkey = $mykey.Name.Replace("HKEY_LOCAL_MACHINE\","HKLM:\") $useractivesetupkey = $mykey.Name.Replace("HKEY_LOCAL_MACHINE\","HKCU:\") $machinedescription = "" $userdescription = "" $machinereferencefile = "" $machinecommand = "" $machinetype = "" try { $machinedescription = Get-ItemPropertyValue -Path $machineactivesetupkey -Name "Description" -ErrorAction Ignore } catch { } try { $userdescription = Get-ItemPropertyValue -Path $useractivesetupkey -Name "Description" -ErrorAction Ignore } catch { } try { $userdescription = Get-ItemPropertyValue -Path $useractivesetupkey -Name "Description" -ErrorAction Ignore } catch { } try { $machinecommand = Get-ItemPropertyValue -Path $machineactivesetupkey -Name "Command" -ErrorAction Ignore } catch { } try { $machinereferencefile = Get-ItemPropertyValue -Path $machineactivesetupkey -Name "ReferenceFile" -ErrorAction Ignore } catch { } try { $machinereferencereg = Get-ItemPropertyValue -Path $machineactivesetupkey -Name "ReferenceReg" -ErrorAction Ignore } catch { } try { $machinetype = Get-ItemPropertyValue -Path $machineactivesetupkey -Name "Type" -ErrorAction Ignore } catch { } # handle install if($machinetype -eq "install") { if($userdescription -ne $machinedescription) { #check if valid $isvalid = $true if($machinereferencefile -ne "") { try { if(Test-Path $machinereferencefile) { #ok } else { $isvalid = $false } } catch { } } if($machinereferencereg -ne "") { $testreg = $machinereferencereg.Replace("HKEY_LOCAL_MACHINE\","HKLM:\") $testreg = $testreg.Replace("HKLM\","HKLM:\") try { if(Test-Path $testreg) { #ok } else { $isvalid = $false } } catch { } } if($isvalid) { try { Start-Process $machinecommand -Wait -WindowStyle Hidden } catch { } try { New-Item -Path "HKCU:\SOFTWARE\Microsoft\Active Setup Advanced" -Force } catch { } try { New-Item -Path $useractivesetupkey -Force } catch { } $userdate = Get-Date -Format "yyyy-MM-ddTHH:mm:ss" try { New-ItemProperty -Path $useractivesetupkey -Name "Description" -Value $machinedescription } catch { } try { New-ItemProperty -Path $useractivesetupkey -Name "DateTime" -Value $userdate } catch { } } } } # handle uninstall if($machinetype -eq "uninstall") { if($userdescription -ne $machinedescription) { $isvalid = $true if($isvalid) { try { Start-Process $machinecommand -Wait -WindowStyle Hidden } catch { } try { New-Item -Path "HKCU:\SOFTWARE\Microsoft\Active Setup Advanced" -Force } catch { } try { New-Item -Path $useractivesetupkey -Force } catch { } $userdate = Get-Date -Format "yyyy-MM-ddTHH:mm:ss" try { New-ItemProperty -Path $useractivesetupkey -Name "Description" -Value $machinedescription } catch { } try { New-ItemProperty -Path $useractivesetupkey -Name "DateTime" -Value $userdate } catch { } } } } }