You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#Remove the Username or SID from Registry key path
458
+
If($LGPOHive-eq'User'){
459
+
$UserID=$RegKeyPath.Split('\')[0]
460
+
If($UserID-match"DEFAULT|S-1-5-21-(\d+-?){4}$"){
461
+
$RegKeyPath=$RegKeyPath.Replace($UserID+"\","")
462
+
}
463
+
}
464
+
456
465
#complete LGPO file
457
466
Write-LogEntry ("LGPO applying [{3}] to registry: [{0}\{1}\{2}] as a Group Policy item"-f$RegHive,$RegKeyPath,$RegKeyName,$RegKeyName) -Severity 4-Source ${CmdletName}
Write-LogEntry-Message "Get information for installed Application Name(s) [$($name-join', ')]..."-Source ${CmdletName}-Outhost:$Outhost
774
+
Write-LogEntry-Message "Get information for installed Application Name(s) [$($name-join', ')]..."-Severity 4-Source ${CmdletName}-Outhost:$Global:Verbose
756
775
}
757
776
If ($productCode) {
758
-
Write-LogEntry-Message "Get information for installed Product Code [$ProductCode]..."-Source ${CmdletName}-Outhost:$Outhost
777
+
Write-LogEntry-Message "Get information for installed Product Code [$ProductCode]..."-Severity 4-Source ${CmdletName}-Outhost:$Global:Verbose
759
778
}
760
779
761
780
## Enumerate the installed applications from the registry for applications that have the "DisplayName" property
@@ -769,14 +788,14 @@ Function Get-InstalledApplication {
769
788
If ($regKeyApplicationProps.DisplayName) { [psobject[]]$regKeyApplication+=$regKeyApplicationProps }
770
789
}
771
790
Catch{
772
-
Write-LogEntry-Message "Unable to enumerate properties from registry key path [$($UninstallKeyApp.PSPath)]. `n$(Resolve-Error)"-Severity 2-Source ${CmdletName}-Outhost:$Outhost
791
+
Write-LogEntry-Message "Unable to enumerate properties from registry key path [$($UninstallKeyApp.PSPath)]. `n$(Resolve-Error)"-Severity 2-Source ${CmdletName}-Outhost:$Global:OutTohost
773
792
Continue
774
793
}
775
794
}
776
795
}
777
796
}
778
797
If ($ErrorUninstallKeyPath) {
779
-
Write-LogEntry-Message "The following error(s) took place while enumerating installed applications from the registry. `n$(Resolve-Error-ErrorRecord $ErrorUninstallKeyPath)"-Severity 2-Source ${CmdletName}-Outhost:$Outhost
798
+
Write-LogEntry-Message "The following error(s) took place while enumerating installed applications from the registry. `n$(Resolve-Error-ErrorRecord $ErrorUninstallKeyPath)"-Severity 2-Source ${CmdletName}-Outhost:$Global:OutTohost
780
799
}
781
800
782
801
## Create a custom object with the desired properties for the installed applications and sanitize property details
@@ -806,7 +825,7 @@ Function Get-InstalledApplication {
806
825
If ($ProductCode) {
807
826
## Verify if there is a match with the product code passed to the script
808
827
If ($regKeyApp.PSChildName-match [regex]::Escape($productCode)) {
@@ -830,27 +849,27 @@ Function Get-InstalledApplication {
830
849
# Check for an exact application name match
831
850
If ($regKeyApp.DisplayName-eq$application) {
832
851
$applicationMatched=$true
833
-
Write-LogEntry-Message "Found installed application [$appDisplayName] version [$appDisplayVersion] using exact name matching for search term [$application]."-Source ${CmdletName}
852
+
Write-LogEntry-Message "Found installed application [$appDisplayName] version [$appDisplayVersion] using exact name matching for search term [$application]."-Source ${CmdletName}-Outhost
834
853
}
835
854
}
836
855
ElseIf ($WildCard) {
837
856
# Check for wildcard application name match
838
857
If ($regKeyApp.DisplayName-like$application) {
839
858
$applicationMatched=$true
840
-
Write-LogEntry-Message "Found installed application [$appDisplayName] version [$appDisplayVersion] using wildcard matching for search term [$application]."-Source ${CmdletName}
859
+
Write-LogEntry-Message "Found installed application [$appDisplayName] version [$appDisplayVersion] using wildcard matching for search term [$application]."-Source ${CmdletName}-Outhost
841
860
}
842
861
}
843
862
ElseIf ($RegEx) {
844
863
# Check for a regex application name match
845
864
If ($regKeyApp.DisplayName-match$application) {
846
865
$applicationMatched=$true
847
-
Write-LogEntry-Message "Found installed application [$appDisplayName] version [$appDisplayVersion] using regex matching for search term [$application]."-Source ${CmdletName}
866
+
Write-LogEntry-Message "Found installed application [$appDisplayName] version [$appDisplayVersion] using regex matching for search term [$application]."-Source ${CmdletName}-Outhost
Write-LogEntry-Message "Found installed application [$appDisplayName] version [$appDisplayVersion] using contains matching for search term [$application]."-Source ${CmdletName}
872
+
Write-LogEntry-Message "Found installed application [$appDisplayName] version [$appDisplayVersion] using contains matching for search term [$application]."-Source ${CmdletName}-Outhost
854
873
}
855
874
856
875
If ($applicationMatched) {
@@ -871,7 +890,7 @@ Function Get-InstalledApplication {
871
890
}
872
891
}
873
892
Catch {
874
-
Write-LogEntry-Message "Failed to resolve application details from registry for [$appDisplayName]. `n$(Resolve-Error)"-Severity 3-Source ${CmdletName}-Outhost:$Outhost
893
+
Write-LogEntry-Message "Failed to resolve application details from registry for [$appDisplayName]. `n$(Resolve-Error)"-Severity 3-Source ${CmdletName}-Outhost
Set-UserSetting-Message "Disabling First Run Boot for Office 2016"-Path "SOFTWARE\Microsoft\Office\$OfficeVersion\FirstRun"-Name 'BootRTM'-Type DWord -Value 1-Force
1009
-
Set-UserSetting-Message "Disabling First Run Movie for Office 2016"-Path "SOFTWARE\Microsoft\Office\$OfficeVersion\FirstRun"-Name 'DisableMovie'-Type DWord -Value 1-Force
1010
-
Set-UserSetting-Message "Disabling First Run Optin for Office 2016"-Path "SOFTWARE\Microsoft\Office\$OfficeVersion\Common\General"-Name 'showfirstrunoptin'-Type DWord -Value 1-Force
1011
-
Set-UserSetting-Message "Disabling First Run Optin for Office 2016"-Path "SOFTWARE\Microsoft\Office\$OfficeVersion\Common\PTWatson"-Name 'PTWOption'-Type DWord -Value 1-Force
Set-UserSetting-Message "Disabling Animation for $OfficeTitle"-Path 'SOFTWARE\Microsoft\Office\$OfficeVersion\Common\Graphics'-Name 'DisableAnimation'-Type DWord -Value 1-Force
1020
+
Set-UserSetting-Message "Disabling First Run Boot for $OfficeTitle"-Path 'SOFTWARE\Microsoft\Office\$OfficeVersion\FirstRun'-Name 'BootRTM'-Type DWord -Value 1-Force
1021
+
Set-UserSetting-Message "Disabling First Run Movie for $OfficeTitle"-Path 'SOFTWARE\Microsoft\Office\$OfficeVersion\FirstRun'-Name 'DisableMovie'-Type DWord -Value 1-Force
1022
+
Set-UserSetting-Message "Disabling First Run Optin for $OfficeTitle"-Path 'SOFTWARE\Microsoft\Office\$OfficeVersion\Common\General'-Name 'showfirstrunoptin'-Type DWord -Value 1-Force
1023
+
Set-UserSetting-Message "Disabling First Run Optin for $OfficeTitle"-Path 'SOFTWARE\Microsoft\Office\$OfficeVersion\Common\PTWatson'-Name 'PTWOption'-Type DWord -Value 1-Force
1024
+
Set-UserSetting-Message "Disabling CEIP for $OfficeTitle"-Path 'SOFTWARE\Microsoft\Office\$OfficeVersion\Common'-Name 'qmenable'-Type DWord -Value 1-Force
1025
+
Set-UserSetting-Message "Accepting Eulas for $OfficeTitle"-Path 'SOFTWARE\Microsoft\Office\$OfficeVersion\Registration'-Name 'AcceptAllEulas'-Type DWord -Value 1-Force
0 commit comments