Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3ff134d

Browse files
updated default type
1 parent382d925 commit3ff134d

File tree

3 files changed

+333
-330
lines changed

3 files changed

+333
-330
lines changed

‎AppOptimizeAndConfig.ps1‎

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
2727
.NOTES
2828
Author: Richard Tracy
29-
Last Update: 05/29/2019
30-
Version: 1.1.4
29+
Last Update: 05/30/2019
30+
Version: 1.1.5
3131
Thanks to: unixuser011,W4RH4WK,TheVDIGuys,cluberti
3232
3333
.EXAMPLE
@@ -49,6 +49,7 @@
4949
https://github.com/cluberti/VDI/blob/master/ConfigAsVDI.ps1
5050
5151
.LOG
52+
1.1.5 - May 30, 2019 - defaulted reg type to dword if not specified, standarized registry keys captalizations
5253
1.1.4 - May 29, 2019 - fixed FOD issue and messages. fixed set-usersettings default users; fixed office detection
5354
resolved all VSC problems
5455
1.1.3 - May 28, 2019 - fixed Get-SMSTSENV log path
@@ -117,7 +118,7 @@ Function Get-SMSTSENV{
117118
}
118119
catch{
119120
If(${CmdletName}){$prefix="${CmdletName} ::" }Else{$prefix="" }
120-
If(!$NoWarning){Write-Warning ("{0}Task Sequence environment not detected. Running in stand-alone mode."-f$prefix)}
121+
If(!$NoWarning){Write-Warning ("{0}Task Sequence environment not detected. Running in stand-alone mode"-f$prefix)}
121122

122123
#set variable to null
123124
$Script:tsenv=$null
@@ -159,9 +160,9 @@ Function Get-SMSTSENV{
159160

160161
FunctionFormat-ElapsedTime($ts) {
161162
$elapsedTime=""
162-
if ($ts.Minutes-gt0 ){$elapsedTime= [string]::Format("{0:00} min. {1:00}.{2:00} sec.",$ts.Minutes,$ts.Seconds,$ts.Milliseconds/10 );}
163-
else{$elapsedTime= [string]::Format("{0:00}.{1:00} sec.",$ts.Seconds,$ts.Milliseconds/10 );}
164-
if ($ts.Hours-eq0-and$ts.Minutes-eq0-and$ts.Seconds-eq0){$elapsedTime= [string]::Format("{0:00} ms.",$ts.Milliseconds);}
163+
if ($ts.Minutes-gt0 ){$elapsedTime= [string]::Format("{0:00} min. {1:00}.{2:00} sec",$ts.Minutes,$ts.Seconds,$ts.Milliseconds/10 );}
164+
else{$elapsedTime= [string]::Format("{0:00}.{1:00} sec",$ts.Seconds,$ts.Milliseconds/10 );}
165+
if ($ts.Hours-eq0-and$ts.Minutes-eq0-and$ts.Seconds-eq0){$elapsedTime= [string]::Format("{0:00} ms",$ts.Milliseconds);}
165166
if ($ts.Milliseconds-eq0){$elapsedTime= [string]::Format("{0} ms",$ts.TotalMilliseconds);}
166167
return$elapsedTime
167168
}
@@ -183,7 +184,7 @@ Function Write-LogEntry{
183184
[ValidateSet(0,1,2,3,4)]
184185
[int16]$Severity,
185186

186-
[parameter(Mandatory=$false,HelpMessage="Name of the log file that the entry will written to.")]
187+
[parameter(Mandatory=$false,HelpMessage="Name of the log file that the entry will written to")]
187188
[ValidateNotNullOrEmpty()]
188189
[string]$OutputLogFile=$Global:LogFilePath,
189190

@@ -435,7 +436,7 @@ Function Set-SystemSetting {
435436
'DWord' {$LGPORegType='DWORD'}
436437
'QWord' {$LGPORegType='DWORD_BIG_ENDIAN'}
437438
'MultiString' {$LGPORegType='LINK'}
438-
default {$LGPORegType='DWORD'}
439+
default {$LGPORegType='DWORD';$Type='DWord'}
439440
}
440441

441442
Try{
@@ -483,12 +484,12 @@ Function Set-SystemSetting {
483484
}
484485
}
485486
Else{
486-
Write-LogEntry ("LGPO not enabled. Hardcoding registry keys [{0}\{1}\{2}]...."-f$RegHive,$RegKeyPath,$RegKeyName)-Severity0-Source${CmdletName}
487+
Write-LogEntry ("LGPO not enabled. Hardcoding registry keys [{0}\{1}\{2}]"-f$RegHive,$RegKeyPath,$RegKeyName)-Severity0-Source${CmdletName}
487488
}
488489
}
489490
Catch{
490491
If($TryLGPO-and$LGPOExe){
491-
Write-LogEntry ("LGPO failed to run. exit code: {0}. Hardcoding registry keys [{1}\{2}\{3}]...."-f$result.ExitCode,$RegHive,$RegKeyPath,$RegKeyName)-Severity3-Source${CmdletName}
492+
Write-LogEntry ("LGPO failed to run. exit code: {0}. Hardcoding registry keys [{1}\{2}\{3}]"-f$result.ExitCode,$RegHive,$RegKeyPath,$RegKeyName)-Severity3-Source${CmdletName}
492493
}
493494
}
494495
Finally
@@ -499,7 +500,7 @@ Function Set-SystemSetting {
499500
#verify the registry value has been set
500501
Try{
501502
If(-not(Test-Path ($RegHive+'\'+$RegKeyPath)) ){
502-
Write-LogEntry ("Key was not set; Hardcoding registry keys [{0}\{1}] with value [{2}]...."-f ($RegHive+'\'+$RegKeyPath),$RegKeyName,$Value)-Severity0-Source${CmdletName}
503+
Write-LogEntry ("Key was not set; Hardcoding registry keys [{0}\{1}] with value [{2}]"-f ($RegHive+'\'+$RegKeyPath),$RegKeyName,$Value)-Severity0-Source${CmdletName}
503504
New-Item-Path ($RegHive+'\'+$RegKeyPath)-Force-WhatIf:$WhatIfPreference-ErrorAction SilentlyContinue|Out-Null
504505
New-ItemProperty-Path ($RegHive+'\'+$RegKeyPath)-Name$RegKeyName-PropertyType$Type-Value$Value-Force:$Force-WhatIf:$WhatIfPreference-ErrorAction SilentlyContinue-PassThru
505506
}
@@ -654,7 +655,7 @@ Function Set-UserSetting {
654655
}
655656
}
656657
Else{
657-
Write-LogEntry ("User registry hive was not found or specified in Keypath [{0}]. Either use the -ApplyTo Switch or specify user hive [eg. HKCU\]..."-f$RegPath)-Severity3-Source${CmdletName}
658+
Write-LogEntry ("User registry hive was not found or specified in Keypath [{0}]. Either use the -ApplyTo Switch or specify user hive [eg. HKCU\].."-f$RegPath)-Severity3-Source${CmdletName}
658659
return
659660
}
660661

@@ -682,7 +683,7 @@ Function Set-UserSetting {
682683
}
683684

684685
If ($HiveLoaded-eq$true) {
685-
If($Message){Write-LogEntry ("{0} for User [{1}]..."-f$Message,$UserName)}
686+
If($Message){Write-LogEntry ("{0} for User [{1}].."-f$Message,$UserName)}
686687
If($Remove){
687688
Remove-ItemProperty"$RegHive\$($UserProfile.SID)\$RegKeyPath"-Name$RegKeyName-Force:$Force-WhatIf:$WhatIfPreference-ErrorAction SilentlyContinue|Out-Null
688689
}
@@ -701,7 +702,7 @@ Function Set-UserSetting {
701702
}
702703
}
703704
Else{
704-
If($Message){Write-LogEntry ("{0} for [{1}]..."-f$Message,$ProfileList.UserName)}
705+
If($Message){Write-LogEntry ("{0} for [{1}].."-f$Message,$ProfileList.UserName)}
705706
If($Remove){
706707
Remove-ItemProperty"$RegHive\$RegKeyPath\$RegKeyPath"-Name$RegKeyName-Force:$Force-WhatIf:$WhatIfPreference-ErrorAction SilentlyContinue|Out-Null
707708
}
@@ -771,10 +772,10 @@ Function Get-InstalledApplication {
771772
}
772773
Process {
773774
If ($name) {
774-
Write-LogEntry-Message"Get information for installed Application Name(s) [$($name-join',')]..."-Severity4-Source${CmdletName}-Outhost:$Global:Verbose
775+
Write-LogEntry-Message"Get information for installed Application Name(s) [$($name-join',')].."-Severity4-Source${CmdletName}-Outhost:$Global:Verbose
775776
}
776777
If ($productCode) {
777-
Write-LogEntry-Message"Get information for installed Product Code [$ProductCode]..."-Severity4-Source${CmdletName}-Outhost:$Global:Verbose
778+
Write-LogEntry-Message"Get information for installed Product Code [$ProductCode].."-Severity4-Source${CmdletName}-Outhost:$Global:Verbose
778779
}
779780

780781
## Enumerate the installed applications from the registry for applications that have the "DisplayName" property
@@ -825,7 +826,7 @@ Function Get-InstalledApplication {
825826
If ($ProductCode) {
826827
## Verify if there is a match with the product code passed to the script
827828
If ($regKeyApp.PSChildName-match [regex]::Escape($productCode)) {
828-
Write-LogEntry-Message"Found installed application [$appDisplayName] version [$appDisplayVersion] matching product code [$productCode]."-Source${CmdletName}-Outhost
829+
Write-LogEntry-Message"Found installed application [$appDisplayName] version [$appDisplayVersion] matching product code [$productCode]"-Source${CmdletName}-Outhost
829830
$installedApplication+=New-Object-TypeName'PSObject'-Property@{
830831
UninstallSubkey=$regKeyApp.PSChildName
831832
ProductCode=If ($regKeyApp.PSChildName-match$MSIProductCodeRegExPattern) {$regKeyApp.PSChildName }Else { [string]::Empty }
@@ -849,27 +850,27 @@ Function Get-InstalledApplication {
849850
# Check for an exact application name match
850851
If ($regKeyApp.DisplayName-eq$application) {
851852
$applicationMatched=$true
852-
Write-LogEntry-Message"Found installed application [$appDisplayName] version [$appDisplayVersion] using exact name matching for search term [$application]."-Source${CmdletName}-Outhost
853+
Write-LogEntry-Message"Found installed application [$appDisplayName] version [$appDisplayVersion] using exact name matching for search term [$application]"-Source${CmdletName}-Outhost
853854
}
854855
}
855856
ElseIf ($WildCard) {
856857
# Check for wildcard application name match
857858
If ($regKeyApp.DisplayName-like$application) {
858859
$applicationMatched=$true
859-
Write-LogEntry-Message"Found installed application [$appDisplayName] version [$appDisplayVersion] using wildcard matching for search term [$application]."-Source${CmdletName}-Outhost
860+
Write-LogEntry-Message"Found installed application [$appDisplayName] version [$appDisplayVersion] using wildcard matching for search term [$application]"-Source${CmdletName}-Outhost
860861
}
861862
}
862863
ElseIf ($RegEx) {
863864
# Check for a regex application name match
864865
If ($regKeyApp.DisplayName-match$application) {
865866
$applicationMatched=$true
866-
Write-LogEntry-Message"Found installed application [$appDisplayName] version [$appDisplayVersion] using regex matching for search term [$application]."-Source${CmdletName}-Outhost
867+
Write-LogEntry-Message"Found installed application [$appDisplayName] version [$appDisplayVersion] using regex matching for search term [$application]"-Source${CmdletName}-Outhost
867868
}
868869
}
869870
# Check for a contains application name match
870871
ElseIf ($regKeyApp.DisplayName-match [regex]::Escape($application)) {
871872
$applicationMatched=$true
872-
Write-LogEntry-Message"Found installed application [$appDisplayName] version [$appDisplayVersion] using contains matching for search term [$application]."-Source${CmdletName}-Outhost
873+
Write-LogEntry-Message"Found installed application [$appDisplayName] version [$appDisplayVersion] using contains matching for search term [$application]"-Source${CmdletName}-Outhost
873874
}
874875

875876
If ($applicationMatched) {
@@ -921,7 +922,7 @@ $Global:Verbose = $false
921922
If($PSBoundParameters.ContainsKey('Debug')-or$PSBoundParameters.ContainsKey('Verbose')){
922923
$Global:Verbose=$PsBoundParameters.Get_Item('Verbose')
923924
$VerbosePreference='Continue'
924-
Write-Verbose ("[{0}] [{1}] :: VERBOSE IS ENABLED."-f (Format-DatePrefix),$scriptName)
925+
Write-Verbose ("[{0}] [{1}] :: VERBOSE IS ENABLED"-f (Format-DatePrefix),$scriptName)
925926
}
926927
Else{
927928
$VerbosePreference='SilentlyContinue'
@@ -1008,22 +1009,22 @@ Else{$stepCounter++}
10081009

10091010

10101011
If ($DisableOfficeAnimation-and$OfficeInstalled){
1011-
Set-UserSetting-Message"Disabling OST Cache mode for$OfficeTitle"-Path'SOFTWARE\Policies\Microsoft\Office\$OfficeVersion\Outlook\ost'-Name'NoOST'-Type DWord-Value2-Force
1012-
Set-UserSetting-Message"Disabling Exchange cache mode for$OfficeTitle"-Path'SOFTWARE\Policies\Microsoft\Office\$OfficeVersion\Outlook\cache mode'-Name'Enable'-Type DWord-Value0-Force
1012+
Set-UserSetting-Message"Disabling OST Cache mode for$OfficeTitle"-Path"SOFTWARE\Policies\Microsoft\Office\$OfficeVersion\Outlook\ost"-Name'NoOST'-Type DWord-Value2-Force
1013+
Set-UserSetting-Message"Disabling Exchange cache mode for$OfficeTitle"-Path"SOFTWARE\Policies\Microsoft\Office\$OfficeVersion\Outlook\cache mode"-Name'Enable'-Type DWord-Value0-Force
10131014
}
10141015
Else{$stepCounter++}
10151016

10161017

10171018
If ($DisableOfficeAnimation-and$OfficeInstalled){
1018-
Set-UserSetting-Message"Disabling Hardware Acceleration for$OfficeTitle"-Path'SOFTWARE\Microsoft\Office\$OfficeVersion\Common\Graphics'-Name'DisableHardwareAcceleration'-Type DWord-Value1-Force
1019-
Set-UserSetting-Message"Disabling Animation for$OfficeTitle"-Path'SOFTWARE\Microsoft\Office\$OfficeVersion\Common\Graphics'-Name'DisableAnimation'-Type DWord-Value1-Force
1020-
Set-UserSetting-Message"Disabling First Run Boot for$OfficeTitle"-Path'SOFTWARE\Microsoft\Office\$OfficeVersion\FirstRun'-Name'BootRTM'-Type DWord-Value1-Force
1021-
Set-UserSetting-Message"Disabling First Run Movie for$OfficeTitle"-Path'SOFTWARE\Microsoft\Office\$OfficeVersion\FirstRun'-Name'DisableMovie'-Type DWord-Value1-Force
1022-
Set-UserSetting-Message"Disabling First Run Optin for$OfficeTitle"-Path'SOFTWARE\Microsoft\Office\$OfficeVersion\Common\General'-Name'showfirstrunoptin'-Type DWord-Value1-Force
1023-
Set-UserSetting-Message"Disabling First Run Optin for$OfficeTitle"-Path'SOFTWARE\Microsoft\Office\$OfficeVersion\Common\PTWatson'-Name'PTWOption'-Type DWord-Value1-Force
1024-
Set-UserSetting-Message"Disabling CEIP for$OfficeTitle"-Path'SOFTWARE\Microsoft\Office\$OfficeVersion\Common'-Name'qmenable'-Type DWord-Value1-Force
1025-
Set-UserSetting-Message"Accepting Eulas for$OfficeTitle"-Path'SOFTWARE\Microsoft\Office\$OfficeVersion\Registration'-Name'AcceptAllEulas'-Type DWord-Value1-Force
1026-
Set-UserSetting-Message"Disabling Default File Types for$OfficeTitle"-Path'SOFTWARE\Microsoft\Office\$OfficeVersion\Common\General'-Name'ShownFileFmtPrompt'-Type DWord-Value1-Force
1019+
Set-UserSetting-Message"Disabling Hardware Acceleration for$OfficeTitle"-Path"SOFTWARE\Microsoft\Office\$OfficeVersion\Common\Graphics"-Name'DisableHardwareAcceleration'-Type DWord-Value1-Force
1020+
Set-UserSetting-Message"Disabling Animation for$OfficeTitle"-Path"SOFTWARE\Microsoft\Office\$OfficeVersion\Common\Graphics"-Name'DisableAnimation'-Type DWord-Value1-Force
1021+
Set-UserSetting-Message"Disabling First Run Boot for$OfficeTitle"-Path"SOFTWARE\Microsoft\Office\$OfficeVersion\FirstRun"-Name'BootRTM'-Type DWord-Value1-Force
1022+
Set-UserSetting-Message"Disabling First Run Movie for$OfficeTitle"-Path"SOFTWARE\Microsoft\Office\$OfficeVersion\FirstRun"-Name'DisableMovie'-Type DWord-Value1-Force
1023+
Set-UserSetting-Message"Disabling First Run Optin for$OfficeTitle"-Path"SOFTWARE\Microsoft\Office\$OfficeVersion\Common\General"-Name'showfirstrunoptin'-Type DWord-Value1-Force
1024+
Set-UserSetting-Message"Disabling First Run Optin for$OfficeTitle"-Path"SOFTWARE\Microsoft\Office\$OfficeVersion\Common\PTWatson"-Name'PTWOption'-Type DWord-Value1-Force
1025+
Set-UserSetting-Message"Disabling CEIP for$OfficeTitle"-Path"SOFTWARE\Microsoft\Office\$OfficeVersion\Common"-Name'qmenable'-Type DWord-Value1-Force
1026+
Set-UserSetting-Message"Accepting Eulas for$OfficeTitle"-Path"SOFTWARE\Microsoft\Office\$OfficeVersion\Registration"-Name'AcceptAllEulas'-Type DWord-Value1-Force
1027+
Set-UserSetting-Message"Disabling Default File Types for$OfficeTitle"-Path"SOFTWARE\Microsoft\Office\$OfficeVersion\Common\General"-Name'ShownFileFmtPrompt'-Type DWord-Value1-Force
10271028
}
10281029
Else{$stepCounter++}
10291030

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp