Skip to content

Commit 52a9785

Browse files
committed
Prep for SQL Saturday 442 - Orlando 2015
Set Strict on all and Get Product-Key for 01 - Server Appliance for OS/Windows
1 parent 1dfed9d commit 52a9785

32 files changed

+76
-24
lines changed

Scripts/01_Server_Appliance.ps1

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ Param(
4040
[string]$mypass
4141
)
4242

43+
Set-StrictMode -Version latest;
4344

4445
[string]$BaseFolder = (Get-Item -Path ".\" -Verbose).FullName
4546

4647
# Import-Module "sqlps" -DisableNameChecking -erroraction SilentlyContinue
4748
Import-Module ".\LoadSQLSMO"
49+
Import-Module ".\Get-ProductKey.psm1"
4850
LoadSQLSMO
4951

5052

@@ -65,6 +67,10 @@ Write-Output "Server $SQLInstance"
6567
# fix target servername if given a SQL named instance
6668
$WinServer = ($SQLInstance -split {$_ -eq "," -or $_ -eq "\"})[0]
6769

70+
71+
# Test Get Product-Key
72+
$ProdKey = Get-ProductKey -Computername $winserver
73+
6874
# Server connection check
6975
[string]$serverauth = "win"
7076
if ($mypass.Length -ge 1 -and $myuser.Length -ge 1)
@@ -160,67 +166,71 @@ else
160166

161167
$myCreateDate = $sqlresults.column1
162168
$mystring = "Server Create Date: " +$MyCreateDate
163-
$mystring| out-file $fullFileName -Encoding ascii -Append
169+
$mystring | out-file $fullFileName -Encoding ascii -Append
164170

165171
$mystring = "Server Name: " +$srv.Name
166-
$mystring| out-file $fullFileName -Encoding ascii -Append
172+
$mystring | out-file $fullFileName -Encoding ascii -Append
167173

168174
$mystring = "SQL Version: " +$srv.Version
169-
$mystring| out-file $fullFileName -Encoding ascii -Append
175+
$mystring | out-file $fullFileName -Encoding ascii -Append
170176

171177
$mystring = "SQL Edition: " +$srv.EngineEdition
172-
$mystring| out-file $fullFileName -Encoding ascii -Append
178+
$mystring | out-file $fullFileName -Encoding ascii -Append
173179

174180
$mystring = "SQL Build Number: " +$srv.BuildNumber
175-
$mystring| out-file $fullFileName -Encoding ascii -Append
181+
$mystring | out-file $fullFileName -Encoding ascii -Append
176182

177183
$mystring = "SQL Product: " +$srv.Product
178-
$mystring| out-file $fullFileName -Encoding ascii -Append
184+
$mystring | out-file $fullFileName -Encoding ascii -Append
179185

180186
$mystring = "SQL Product Level: " +$srv.ProductLevel
181-
$mystring| out-file $fullFileName -Encoding ascii -Append
187+
$mystring | out-file $fullFileName -Encoding ascii -Append
182188

183189
$mystring = "SQL Processors: " +$srv.Processors
184-
$mystring| out-file $fullFileName -Encoding ascii -Append
190+
$mystring | out-file $fullFileName -Encoding ascii -Append
185191

186192
$mystring = "SQL Max Physical Memory MB: " +$srv.PhysicalMemory
187-
$mystring| out-file $fullFileName -Encoding ascii -Append
193+
$mystring | out-file $fullFileName -Encoding ascii -Append
188194

189195
$mystring = "SQL Physical Memory in Use MB: " +$srv.PhysicalMemoryUsageinKB
190-
$mystring| out-file $fullFileName -Encoding ascii -Append
196+
$mystring | out-file $fullFileName -Encoding ascii -Append
191197

192198
$mystring = "SQL MasterDB Path: " +$srv.MasterDBPath
193-
$mystring| out-file $fullFileName -Encoding ascii -Append
199+
$mystring | out-file $fullFileName -Encoding ascii -Append
194200

195201
$mystring = "SQL MasterDB LogPath: " +$srv.MasterDBLogPath
196-
$mystring| out-file $fullFileName -Encoding ascii -Append
202+
$mystring | out-file $fullFileName -Encoding ascii -Append
197203

198204
$mystring = "SQL Backup Directory: " +$srv.BackupDirectory
199-
$mystring| out-file $fullFileName -Encoding ascii -Append
205+
$mystring | out-file $fullFileName -Encoding ascii -Append
200206

201207
$mystring = "SQL Install Shared Dir: " +$srv.InstallSharedDirectory
202-
$mystring| out-file $fullFileName -Encoding ascii -Append
208+
$mystring | out-file $fullFileName -Encoding ascii -Append
203209

204210
$mystring = "SQL Install Data Dir: " +$srv.InstallDataDirectory
205-
$mystring| out-file $fullFileName -Encoding ascii -Append
211+
$mystring | out-file $fullFileName -Encoding ascii -Append
206212

207213
$mystring = "SQL Service Account: " +$srv.ServiceAccount
208-
$mystring| out-file $fullFileName -Encoding ascii -Append
214+
$mystring | out-file $fullFileName -Encoding ascii -Append
209215

210216
" " | out-file $fullFileName -Encoding ascii -Append
211217

212218
# Windows
213219
$mystring = "OS Version: " +$srv.OSVersion
214-
$mystring| out-file $fullFileName -Encoding ascii -Append
220+
$mystring | out-file $fullFileName -Encoding ascii -Append
215221

216222
$mystring = "OS Is Clustered: " +$srv.IsClustered
217-
$mystring| out-file $fullFileName -Encoding ascii -Append
223+
$mystring | out-file $fullFileName -Encoding ascii -Append
218224

219225
$mystring = "OS Is HADR: " +$srv.IsHadrEnabled
220-
$mystring| out-file $fullFileName -Encoding ascii -Append
226+
$mystring | out-file $fullFileName -Encoding ascii -Append
221227

222228
$mystring = "OS Platform: " +$srv.Platform
223-
$mystring| out-file $fullFileName -Encoding ascii -Append
229+
$mystring | out-file $fullFileName -Encoding ascii -Append
230+
231+
$mystring = "OS Product Key: " +$ProdKey.ProductKey
232+
$mystring | out-file $fullFileName -Encoding ascii -Append
233+
224234

225235

226236
# Turn off default Error Handler for WMI
@@ -248,6 +258,7 @@ else
248258
Write-output "WMI Call to Win32_OperatingSystem class failed "| out-file $fullFileName -Encoding ascii -Append
249259
}
250260

261+
" " | out-file $fullFileName -Encoding ascii -Append
251262

252263
# Hardware
253264
# Turn off default Error Handler for WMI

Scripts/01_Server_Credentials.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Param(
3333
[string]$mypass
3434
)
3535

36+
Set-StrictMode -Version latest;
3637

3738
[string]$BaseFolder = (Get-Item -Path ".\" -Verbose).FullName
3839

Scripts/01_Server_Logins.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Param(
4343
[string]$mypass
4444
)
4545

46+
Set-StrictMode -Version latest;
47+
4648
[string]$BaseFolder = (Get-Item -Path ".\" -Verbose).FullName
4749

4850
# Load SMO Assemblies

Scripts/01_Server_Resource_Governor.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Param(
3232
[string]$mypass
3333
)
3434

35+
Set-StrictMode -Version latest;
3536

3637
[string]$BaseFolder = (Get-Item -Path ".\" -Verbose).FullName
3738

Scripts/01_Server_Roles.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Param(
3232
[string]$mypass
3333
)
3434

35+
Set-StrictMode -Version latest;
3536

3637
[string]$BaseFolder = (Get-Item -Path ".\" -Verbose).FullName
3738

Scripts/01_Server_Settings.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Param(
3434
[string]$mypass
3535
)
3636

37+
Set-StrictMode -Version latest;
38+
3739
[string]$BaseFolder = (Get-Item -Path ".\" -Verbose).FullName
3840

3941
# Script Name

Scripts/01_Server_Shares.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Param(
2929
[string]$mypass
3030
)
3131

32+
Set-StrictMode -Version latest;
3233

3334
[string]$BaseFolder = (Get-Item -Path ".\" -Verbose).FullName
3435

Scripts/01_Server_Startup_Procs.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Param(
3232
[string]$mypass
3333
)
3434

35+
Set-StrictMode -Version latest;
3536

3637
[string]$BaseFolder = (Get-Item -Path ".\" -Verbose).FullName
3738

Scripts/01_Server_Storage.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Param(
3333
[string]$mypass
3434
)
3535

36+
Set-StrictMode -Version latest;
37+
3638
[string]$BaseFolder = (Get-Item -Path ".\" -Verbose).FullName
3739

3840
Write-Host -f Yellow -b Black "01 - Server Storage"

Scripts/01_Server_Triggers.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Param(
3333
[string]$mypass
3434
)
3535

36+
Set-StrictMode -Version latest;
3637

3738
[string]$BaseFolder = (Get-Item -Path ".\" -Verbose).FullName
3839

0 commit comments

Comments
 (0)