Skip to content

Commit 18dd370

Browse files
2 parents 0c950f1 + a2c7d6a commit 18dd370

12 files changed

+103
-1320
lines changed

AppOptimizeAndConfig.ps1

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@
77
Utilizes LGPO.exe to apply group policy item where neceassary.
88
Utilizes MDT/SCCM TaskSequence property control
99
Configurable using custom variables in MDT/SCCM
10+
11+
.INFO
12+
Author: Richard Tracy
13+
Email: richard.tracy@hotmail.com
14+
Twitter: @rick2_1979
15+
Website: www.powershellcrack.com
16+
Last Update: 06/18/2019
17+
Version: 1.1.6
18+
Thanks to: unixuser011,W4RH4WK,TheVDIGuys,cluberti,JGSpiers
19+
20+
.DISCLOSURE
21+
THE SCRIPT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. BY USING OR DISTRIBUTING THIS SCRIPT, YOU AGREE THAT IN NO EVENT
23+
SHALL RICHARD TRACY OR ANY AFFILATES BE HELD LIABLE FOR ANY DAMAGES WHATSOEVER RESULTING FROM USING OR DISTRIBUTION OF THIS SCRIPT, INCLUDING,
24+
WITHOUT LIMITATION, ANY SPECIAL, CONSEQUENTIAL, INCIDENTAL OR OTHER DIRECT OR INDIRECT DAMAGES. BACKUP UP ALL DATA BEFORE PROCEEDING.
1025
1126
.PARAM
1227
'// Global Settings
@@ -24,12 +39,6 @@
2439
CFG_RemoveAppxPackages
2540
CFG_RemoveFODPackages
2641
27-
.NOTES
28-
Author: Richard Tracy
29-
Last Update: 06/5/2019
30-
Version: 1.1.6
31-
Thanks to: unixuser011,W4RH4WK,TheVDIGuys,cluberti
32-
3342
.EXAMPLE
3443
#Copy this to MDT CustomSettings.ini
3544
Properties=CFG_DisableAppScript,CFG_UseLGPOForConfigs,LGPOPath,CFG_DisableOfficeAnimation,CFG_EnableIESoftwareRender,CFG_EnableLyncStartup,CFG_RemoveAppxPackages,CFG_RemoveFODPackages,CFG_RemoveUnusedPrinters
@@ -48,8 +57,8 @@
4857
https://github.com/TheVDIGuys/W10_1803_VDI_Optimize
4958
https://github.com/cluberti/VDI/blob/master/ConfigAsVDI.ps1
5059
51-
.LOG
52-
1.1.6 - Jun 5, 2019 - Fixed Remove-AppxPackage for AllUsers
60+
.CHANGE LOG
61+
1.1.6 - Jun 18, 2019 - Added more info page, change Get-SMSTSENV warning to verbose message
5362
1.1.5 - May 30, 2019 - defaulted reg type to dword if not specified, standarized registry keys captalizations
5463
1.1.4 - May 29, 2019 - fixed FOD issue and messages. fixed set-usersettings default users; fixed office detection
5564
resolved all VSC problems
@@ -102,24 +111,30 @@ Function Get-ScriptPath {
102111
}
103112

104113

114+
105115
Function Get-SMSTSENV{
106116
param(
107-
[switch]$ReturnLogPath,
108-
[switch]$NoWarning
117+
[switch]$ReturnLogPath
109118
)
110119

111120
Begin{
112121
## Get the name of this function
113122
[string]${CmdletName} = $PSCmdlet.MyInvocation.MyCommand.Name
123+
124+
if (-not $PSBoundParameters.ContainsKey('Verbose')) {
125+
$VerbosePreference = $PSCmdlet.SessionState.PSVariable.GetValue('VerbosePreference')
126+
}
114127
}
115128
Process{
129+
If(${CmdletName}){$prefix = "${CmdletName} ::" }Else{$prefix = "" }
130+
116131
try{
117132
# Create an object to access the task sequence environment
118-
$Script:tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
133+
$Script:tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
134+
Write-Verbose ("{0}Task Sequence environment detected!" -f $prefix)
119135
}
120136
catch{
121-
If(${CmdletName}){$prefix = "${CmdletName} ::" }Else{$prefix = "" }
122-
If(!$NoWarning){Write-Warning ("{0}Task Sequence environment not detected. Running in stand-alone mode" -f $prefix)}
137+
Write-Verbose ("{0}Task Sequence environment not detected. Running in stand-alone mode" -f $prefix)
123138

124139
#set variable to null
125140
$Script:tsenv = $null
@@ -129,7 +144,7 @@ Function Get-SMSTSENV{
129144
if ($Script:tsenv){
130145
#grab the progress UI
131146
$Script:TSProgressUi = New-Object -ComObject Microsoft.SMS.TSProgressUI
132-
147+
133148
# Convert all of the variables currently in the environment to PowerShell variables
134149
$tsenv.GetVariables() | ForEach-Object { Set-Variable -Name "$_" -Value "$($tsenv.Value($_))" }
135150

@@ -156,7 +171,8 @@ Function Get-SMSTSENV{
156171
return $Script:tsenv
157172
}
158173
}
159-
}
174+
}
175+
160176

161177

162178
Function Format-ElapsedTime($ts) {
@@ -945,7 +961,7 @@ Else{
945961
#build log name
946962
[string]$FileName = $scriptBaseName +'.log'
947963
#build global log fullpath
948-
$Global:LogFilePath = Join-Path (Get-SMSTSENV -ReturnLogPath -NoWarning) -ChildPath $FileName
964+
$Global:LogFilePath = Join-Path (Get-SMSTSENV -ReturnLogPath -Verbose) -ChildPath $FileName
949965
Write-Host "logging to file: $LogFilePath" -ForegroundColor Cyan
950966

951967

@@ -1010,8 +1026,8 @@ If($OfficeInstalled){
10101026
}
10111027

10121028
#if running in a tasksequence; apply user settings to all user profiles (use ApplyTo param cmdlet Set-UserSettings )
1013-
If(Get-SMSTSENV -NoWarning){$Global:ApplyToProfiles = 'AllUsers'}Else{$Global:ApplyToProfiles = 'CurrentUser'}
1014-
If((Get-SMSTSENV -NoWarning) -and -not($psISE)){$Global:OutToHost = $false}Else{$Global:OutToHost = $true}
1029+
If(Get-SMSTSENV){$Global:ApplyToProfiles = 'AllUsers'}Else{$Global:ApplyToProfiles = 'CurrentUser'}
1030+
If((Get-SMSTSENV) -and -not($psISE)){$Global:OutToHost = $false}Else{$Global:OutToHost = $true}
10151031

10161032
#grab all Show-ProgressStatus commands in script and count them
10171033
$script:Maxsteps = ([System.Management.Automation.PsParser]::Tokenize((Get-Content $scriptPath), [ref]$null) | Where-Object { $_.Type -eq 'Command' -and $_.Content -eq 'Show-ProgressStatus' }).Count

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Windows 10 Optimization And Configurations
2-
- Applies all types of settings for Windows 10. Script variables can be set either internal (standalone) or using MDT/SCCM Task sequence custom properties. Ultimately MDT/SCCM properties will overwrite internal variable if set.
1+
# Windows Optimization And Configurations
2+
- Applies all types of settings for Windows 10 and Server 16. Script variables can be set either internal (standalone) or using MDT/SCCM Task sequence custom properties. Ultimately MDT/SCCM properties will overwrite internal variable if set.
33

44
## Project:
55
- This is part of my <b>MDT automation Project</b>

Scripts/DefaultWindows_Audit.xml

Lines changed: 0 additions & 265 deletions
This file was deleted.
-2.26 KB
Binary file not shown.

0 commit comments

Comments
 (0)