├── .gitattributes
├── .gitignore
├── README.md
└── Tools
├── Action - Update Defender Signatures
└── Action-UpdateDefender.ps1
├── Action-CleanupBeforeSysprep
└── Action-CleanupBeforeSysprep.wsf
├── Add-ComputerToMDTDatabase
└── Add-ComputerToMDTDataBase.ps1
├── Apply - LGPO for Windows Server 2019
├── ApplyLGPO.ps1
└── Invoke-Install.ps1
├── CSDemo
├── AliasUserExit.vbs
├── Readme.txt
├── Samples
│ ├── Disable OSInstall.ini
│ ├── Setting based on Computer type and location.ini
│ ├── Settings based on Computer type.ini
│ ├── Settings based on Default Gateway.ini
│ ├── Settings based on MAC for servers.ini
│ ├── Settings based on MAC.ini
│ ├── Settings based on Model.ini
│ ├── Settings based on TaskSequenceID.ini
│ ├── Settings based on UserExit-Alias.ini
│ ├── Settings based on VB Calculation.ini
│ ├── Settings based on Virtual Machines.ini
│ ├── Settings for UDI.ini
│ └── Using the SMSTSOrg.ini
├── Scripts
│ └── AliasUserExit.vbs
└── test.cmd
├── Check-VIAApprovedModel
├── Check-VIAApprovedModel.ps1
└── VIAApprovedModel.xml
├── Configure - Windows Client
├── AppxProvisionedPackage.txt
├── Configure-WindowsClient.ps1
└── Startmenu.xml
├── Configure - Windows Server
└── Configure-WindowsServer.ps1
├── Configure-DisableServicesforWindowsServer
└── Configure-DisableServicesforWindowsServer.ps1
├── Configure-HPBIOS
└── Configure-HPBIOS.ps1
├── Configure-HPILO
└── Configure-HPILO.ps1
├── Configure-ResetHPILO
└── Reset-HPILO.ps1
├── Connect-VIARDP
└── ConnectVIARDP.psm1
├── Convert-WIM2VHD
└── Convert-WIM2VHD.ps1
├── Convert-WindowsEdition
└── Convert-WindowsEdition.ps1
├── Create-ADUserDemo
├── ImportUsers.ps1
└── settings.xml
├── Create-MDTEvents
└── CreateEvent.ps1
├── Create-VIAComputerName
└── Create-VIAComputerName.ps1
├── Custom-ZTITatoo
├── CustomSettings.ini
├── ReadMe.txt
├── ViaMonstraTatoo.mof
└── ViaMonstraTatoo.wsf
├── Disable-InternetAccess
└── Disable-InternetAccess.ps1
├── Disable-ServerApps
└── Disable-ServerApps.ps1
├── Enable-NestedHyperV
├── EnableNestedHyperV.ps1
├── EnableNestedHyperVSimple.ps1
└── GetNestedHyperVRedniness.PS1
├── Export-ModernDriverPackage
└── Export-ModernDriverPackage.ps1
├── GenOSDStatus
└── GenOSDStatus.ps1
├── GenOSDStatusV2
└── GenOSDStatusV2.ps1
├── Get-ADHealthCheck
└── Get-ADHealthCheck.ps1
├── Get-AllC++Runtimes
├── Get-Downloads.ps1
├── RunMe.ps1
└── download.xml
├── Get-DHCPHealthCheck
└── Get-DHCPHealthCheck.ps1
├── Get-MDTOdata
└── GetMDTOdata.ps1
├── Get-ReliabilityStabilityMetrics
└── Get-ReliabilityStabilityMetrics.ps1
├── Get-TSxEdgeEnterpriseMSIAndInstall
└── Get-TSxEdgeEnterpriseMSIAndInstall.ps1
├── Get-TSxMSEdgeNow
└── Get-TSxMSEdgeNow.ps1
├── Get-VIAActiveDiffDisk
└── GetVIAActiveDiffDisk.ps1
├── Get-VIADisconnectedVHDs
└── GetVIADisconnectedVHDs.psm1
├── Get-VIASCVMMDiskInfo
└── GetVIASCVMMDiskInfo.psm1
├── Get-VIAUnimportedvmcxFiles
└── GetVIAUnimportedvmcxFiles.psm1
├── Get-VMHealthCheck
└── Get-VMHealthCheck.ps1
├── Get-WIMInfo
└── Get-WimInfo.ps1
├── Get-WSUSHealthCheck
└── Get-WSUSHealthCheck.ps1
├── GetILOInfo
└── GetILOInfo.psm1
├── IMF-ConfigMgrImport
└── IMF-ConfigMgrImport.ps1
├── IdentityLifeCyleWoops
├── GetAdminCount.ps1
├── GetAllUsersEnabledAndPasswordNeverExpires.ps1
└── GetAllUsersintheDomainAdminGroup.ps1
├── Import-MDTApps
└── Import-MDTApps.ps1
├── Install - Acrobat Reader DC en
└── Install-AcrobatReaderDC.ps1
├── Install - C++ Runtime v14 framework package for Desktop Bridge
└── Install-C++Runtimev14.ps1
├── Install - Dell command update en
└── Install-Dell_command_update.ps1
├── Install - Microsoft BGInfo - x86-x64
├── Install-MicrosoftBGInfox86x64.wsf
└── Source
│ └── Custom.bgi
├── Install - Microsoft Visual C++
└── Install-MicrosoftVisualC++x86x64.wsf
├── Install - Mozilla Firefox
└── Install-MozillaFirefox.ps1
├── Install - Notepad++
└── Install-NPP.ps1
├── Install - NuGet Provider
└── Install-NuGet.ps1
├── Install - Office 365 ProPlus Project
├── Install-Office365Project.ps1
└── Source
│ ├── Configuration.old.xml
│ ├── Configuration.xml
│ ├── Download.xml
│ ├── configuration-Office365-x64.xml
│ └── installOfficeProPlus64.xml
├── Install - Office 365 ProPlus Visio
├── Install-Office365Visio.ps1
└── Source
│ ├── Configuration.xml
│ ├── Download.xml
│ ├── configuration-Office365-x64.xml
│ └── installOfficeProPlus64.xml
├── Install - Office 365 ProPlus
├── Install-Office365.ps1
└── Source
│ ├── Configuration.old.xml
│ ├── Configuration.xml
│ ├── Download.xml
│ ├── configuration-Office365-x64.xml
│ └── installOfficeProPlus64.xml
├── Install - PDF Creator
└── Install-PDFCreator.ps1
├── Install - Putty
└── Install-Putty.ps1
├── Install - RSAT
└── Install-RSAT.ps1
├── Install - VLCPlayer
└── Install-VLCPlayer.ps1
├── Install - VSCode
└── Install-VSCode.ps1
├── Install - Windows Terminal
└── Install-WindowsTerminal.ps1
├── Install-BIOSUpgrade
└── Install-BIOSUpgrade.ps1
├── Install-HPBIOSCmdlets
└── Install-HPBIOSCmdlets-x64.ps1
├── Install-HPSUM
└── Install-HPSUM.ps1
├── Install-RSATToolsfor1809
└── Install-RSATToolsfor1809.ps1
├── Install-Wrapper
└── Invoke-Install.ps1
├── Install-X86-X64-C++
└── Install-MicrosoftVisualC++x86x64.wsf
├── Invoke-WSUSMaint
├── Invoke-WSUSMaint.ps1
├── RemoveObsoleteUpdates.sql
└── WsusDBMaintenance.sql
├── MDTComputerInventoryStoredProcedure
├── HardwareInfo.vbs
├── IventoryComputer.sql
└── dbupdate.ini
├── MassUpgradeWindows10
├── Invoke-ComputerCleanup.ps1
├── Invoke-ComputerCompatScan.ps1
├── Invoke-ComputerPrep.ps1
├── Invoke-ComputerUpgrade.ps1
├── Invoke-ImageDownload.ps1
└── computers.txt
├── MonitorMDT
└── MonitorMDT.ps1
├── NANORefImageModule
├── NANORefImageModule.psm1
└── NewNANORefImage.ps1
├── New-HyperVM
└── New-HyperVM.ps1
├── OptimizeVHDs
├── OptimizeVHDs.ps1
└── OptimizeVIAVHD.ps1
├── RemoveVMwUI
└── RemoveVMwUI.ps1
├── RemoveVMwUI2
└── RemoveVMwUI2.ps1
├── RestPSFiles
├── Install Choclaty and NSSM.ps1
├── Install NuGet and PowerShellGet.ps1
├── Install and Configure RestPS.ps1
├── Make RestPS a Services.ps1
├── Start RestPS.ps1
├── StartRestPS.ps1
└── Test RestPS.ps1
├── Running-ParJobs
└── Running-ParJobs.ps1
├── Save-AllRunningVMs
└── Save-AllRunningVMs.ps1
├── Set-TSxTimesync
└── Set-TSxTimesync.ps1
├── Start-VIADeDupJob
└── Start-VIADeDupJob.ps1
├── TSxWrite-MDTMonitor
└── TSxWrite-MDTMonitor.ps1
└── Test-ModernDriverPackage
└── Test-ModernDriverPackage.ps1
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear on external disk
35 | .Spotlight-V100
36 | .Trashes
37 |
38 | # Directories potentially created on remote AFP share
39 | .AppleDB
40 | .AppleDesktop
41 | Network Trash Folder
42 | Temporary Items
43 | .apdisk
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Welcome to the Deployment Bunny Script Collection. The idea is to move scripts from my Onedrive and store them on Github instead.
2 | Blog: http://www.deploymentbunny.com
3 | Twitter: @mikael_nystrom
4 |
--------------------------------------------------------------------------------
/Tools/Add-ComputerToMDTDatabase/Add-ComputerToMDTDataBase.ps1:
--------------------------------------------------------------------------------
1 | #Add Computer to the MDT Database 1.0
2 | Param(
3 | [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
4 | [ValidateLength(3,16)]
5 | [ValidatePattern('[A-Z][0-9]')]
6 | [String]$ComputerName,
7 |
8 | [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
9 | [ValidateSet('Standard_PC','RnD','Admin_Workstation')]
10 | [String]$Role,
11 |
12 | [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
13 | [ValidatePattern('^([0-9a-fA-F]{2}[:-]{0,1}){5}[0-9a-fA-F]{2}$')]
14 | [String]$MacAddress,
15 |
16 | [Switch]$Force
17 | )
18 |
19 | #Import the Modules and connect to the database
20 | #Note: You need to have the MDTDB PowerShell module installed as well as the Active Directory module to be able to access the data.
21 | #
22 | Import-Module MDTDB -ErrorAction Stop
23 | Import-Module ActiveDirectory -ErrorAction Stop
24 | Connect-MDTDatabase -sqlServer MDT01 -database MDT01 -instance SQLExpress -ErrorAction stop
25 |
26 | #Create function for check AD if name exists
27 | Function CheckIfComputerInADExists{
28 | Param(
29 | $ComputerName
30 | )
31 | try {
32 | $Null = Get-ADComputer $ComputerName
33 | Return $True
34 | }
35 | Catch {
36 | Return $False
37 | }
38 | }
39 |
40 | #Create function for check MDT DB if name exists
41 | Function CheckIfComputerInMDTExists{
42 | Param(
43 | $ComputerName
44 | )
45 | $result = Get-MDTComputer | Where-Object -Property OSDComputerName -EQ -Value $ComputerName
46 | if($result -ne $null){Return $True}else{$False}
47 | }
48 |
49 | #Create function for check MDT DB if MAC exists
50 | Function CheckIfMacAddressInMDTExists{
51 | Param(
52 | $MacAddress
53 | )
54 | $result = Get-MDTComputer -macAddress $MacAddress
55 | if($result -ne $null){Return $True}else{$False}
56 | }
57 |
58 | #Check if Computer exists in Active Directory
59 | $CheckAD = CheckIfComputerInADExists -ComputerName $ComputerName
60 | if($CheckAD -eq $true){
61 | Write-Warning "$ComputerName exists in Active Directory"
62 | if(!($Force)){BREAK}
63 | }else{Write-Host "AD Name check OK"}
64 |
65 | #Check if Computer exists in the MDT database
66 | $CheckMDT = CheckIfComputerInMDTExists -ComputerName $ComputerName
67 | if($CheckMDT -eq $true){
68 | Write-Warning "$ComputerName exists in the MDT database"
69 | if(!($Force)){BREAK}
70 | }else{Write-Host "MDT name check OK"}
71 |
72 | #Check if MacAddress exists in the MDT database
73 | $CheckMAC = CheckIfMacAddressInMDTExists -MacAddress $MacAddress
74 | if($CheckMAC -eq $true){
75 | Write-Warning "$MacAddress exists in the MDT database"
76 | if(!($Force)){BREAK}
77 | }else{Write-Host "MDT macaddress check OK"}
78 |
79 | #Create array for all settings the computer should have
80 | $Settings = @{
81 | OSInstall='YES';
82 | OSDComputerName="$ComputerName"
83 | }
84 |
85 | #If computer name exists and we used the -Force switch, remove it
86 | if($CheckMDT -eq $true){
87 | Get-MDTComputer -description $ComputerName | Remove-MDTComputer
88 | }
89 |
90 | #If MacAddress exists and we used the -Force switch, remove it
91 | if($CheckMAC -eq $true){
92 | Get-MDTComputer -macAddress $MacAddress | Remove-MDTComputer
93 | }
94 |
95 | #Create Computer in MDT Database
96 | $NewMDTComputer = New-MDTComputer -macAddress $MacAddress -description $ComputerName -settings $Settings
97 |
98 | #Add role to Computer in MDT Database
99 | $NewMDTComputer | Set-MDTComputerRole -roles $Role
100 |
--------------------------------------------------------------------------------
/Tools/CSDemo/Readme.txt:
--------------------------------------------------------------------------------
1 | 1. Modify test.cmd for correct path to ZTIgather.wsf
2 | 2. Store the AliasUserExit.vbs in the script folder on the deploymentshare
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Disable OSInstall.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=Default
3 | Properties=MyCustomProperty
4 |
5 | [Default]
6 | OSInstall=NO
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Setting based on Computer type and location.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=DefaultGateway, ByVMType, ByLaptopType, ByDesktopType, Default
3 | Properties=MyCustomProperty, NameByType, NameByLocation
4 |
5 | [Default]
6 | OSInstall=Y
7 | OSDComputername=%NameByType%-%NameByLocation%-#Left("%SerialNumber%",8)#
8 |
9 | [DefaultGateway]
10 | 192.168.1.1=NEWYORK
11 | 192.168.28.129=REDMOND
12 | 192.168.133.1=REDMOND
13 |
14 | [NEWYORK]
15 | NameByLocation=NY
16 |
17 | [REDMOND]
18 | NameByLocation=RD
19 |
20 | [ByLaptopType]
21 | Subsection=Laptop-%IsLaptop%
22 |
23 | [ByDesktopType]
24 | Subsection=Desktop-%IsDesktop%
25 |
26 | [ByVmType]
27 | Subsection=VM-%IsVM%
28 |
29 | [Laptop-True]
30 | NameByType=WLT
31 |
32 | [Desktop-True]
33 | NameByType=WDT
34 |
35 | [VM-True]
36 | NameByType=WVM
37 |
38 |
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Settings based on Computer type.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=ByLaptopType, ByDesktopType, ByVMType, Default
3 | Properties=MyCustomProperty
4 |
5 | [Default]
6 | OSInstall=Y
7 |
8 | [ByDesktopType]
9 | Subsection=Desktop-%IsDesktop%
10 |
11 | [ByLaptopType]
12 | Subsection=Laptop-%IsLaptop%
13 |
14 | [ByVMType]
15 | Subsection=VM-%IsVM%
16 |
17 | [Desktop-True]
18 | OSDComputername=PC-#Left("%SerialNumber%",12)#
19 |
20 | [Laptop-True]
21 | OSDComputername=LT-#Left("%SerialNumber%",12)#
22 |
23 | [ByVMType]
24 | OSDComputername=VM-#Left("%SerialNumber%",12)#
25 |
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Settings based on Default Gateway.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=DefaultGateWay, Default
3 | Properties=MyCustomProperty
4 |
5 | [Default]
6 | OSInstall=NO
7 |
8 | [DefaultGateWay]
9 | 192.168.29.129=STOCKHOLM
10 | 192.168.28.129=REDMOND
11 |
12 | [STOCKHOLM]
13 | OSInstall=Y
14 | Home_Page=http://www.dn.se
15 | UserLocale=sv-se
16 | UILanguage=sv-se
17 | KeyboardLocale=041d:0000041d
18 | TimeZoneName=W. Europe Standard Time
19 |
20 | [REDMOND]
21 | OSInstall=Y
22 | Home_Page=http://www.ustoday.com
23 | UserLocale=en-us
24 | UILanguage=en-us
25 | KeyboardLocale=0409:00000409
26 | TimeZoneName=Pacific Standard Time
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Settings based on MAC for servers.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=MacAddress,Model,Default
3 | CustomProperty=HyperVSwitch
4 |
5 | [ProLiant BL420c Gen8]
6 | MandatoryApplications001={8ca0ab72-1b94-4b35-9da8-433f760c548c}
7 |
8 | [00:1E:0B:EA:F1:08]
9 | Computername=HOST001
10 | MachineObjectOU=OU=Servers,OU=ViaMonstra,DC=corp,DC=viamonstra,DC=com
11 | SkipTaskSequence=Yes
12 | TaskSequenceID=WS2012HV001
13 | OSDAdapterCount=2
14 | OSDAdapter0MacAddress=00:1E:0B:EA:F1:08
15 | OSDAdapter0EnableDHCP=FALSE
16 | OSDAdapter0IPAddressList=192.168.0.40
17 | OSDAdapter0SubnetMask=255.255.255.0
18 | OSDAdapter0Gateways=192.168.0.1
19 | OSDAdapter0EnableWINS=TRUE
20 | OSDAdapter0WINSServerList=192.168.0.1
21 | OSDAdapter0TCPIPNetBiosOptions=0
22 | OSDAdapter0GatewayCostMetrics=Automatic
23 | OSDAdapter0EnableFullDNSRegistration=TRUE
24 | OSDAdapter0EnableDNSRegistration=TRUE
25 | OSDAdapter1MacAddress=00:1E:0B:EA:E1:FA
26 | OSDAdapter1EnableDHCP=TRUE
27 | OSDAdapter1EnableFullDNSRegistration=FALSE
28 | OSDAdapter1EnableDNSRegistration=FALSE
29 | HyperVSwitch=00:1E:0B:EA:E1:FA
30 | SkipComputerName=YES
31 |
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Settings based on MAC.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=MacAddress, Default
3 | Properties=MyCustomProperty
4 |
5 | [Default]
6 | _SMSTSOrgName=Deploying %TaskSequenceID% to %OSDComputername%
7 | OSInstall=Y
8 | SkipTaskSequence=NO
9 | OSDComputername=PC-#Left("%SerialNumber%",12)#
10 |
11 | [00:15:5D:85:6B:00]
12 | TaskSequenceID=W8X64
13 | SkipTaskSequence=YES
14 | OSDComputername=MYPC001
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Settings based on Model.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=Model, Default
3 | Properties=MyCustomProperty
4 |
5 | [Default]
6 | OSInstall=NO
7 | OSDComputername=PC-#Left("%SerialNumber%",12)#
8 |
9 | [Virtual Machine]
10 | OSInstall=Y
11 |
12 | [HP EliteBook 8540w]
13 | OSInstall=Y
14 |
15 | [HP Compaq 8510w]
16 | OSInstall=Y
17 |
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Settings based on TaskSequenceID.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=TaskSequenceID, Default
3 | Properties=MyCustomProperty
4 |
5 | [Default]
6 | OSInstall=Y
7 |
8 | [W7x86]
9 | DriverGroup001=Windows 7 x86\%model%
10 |
11 | [W7x64]
12 | DriverGroup001=Windows 8 x64\%model%
13 |
14 | [W8x86]
15 | DriverGroup001=Windows 8 x86\%model%
16 |
17 | [W8x64]
18 | DriverGroup001=Windows 8 x64\%model%
19 |
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Settings based on UserExit-Alias.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=HardwareInfo, MakeAlias, ModelAlias,SMBIOSBiosVersion,Default, SetOSD
3 | Properties=ModelAlias,MakeAlias,SMBIOSBiosVersion,MacAlias,OSDPrefix,MachineOULocation
4 |
5 | [HardwareInfo]
6 | UserExit=AliasUserExit.vbs
7 | MakeAlias=#SetMakeAlias()#
8 | ModelAlias=#SetModelAlias()#
9 | SMBIOSBIOSVersion=#SetSMBIOSBIOSVersion()#
10 | MacAlias=#SetMacAlias()#
11 |
12 | [68CVDVerF22]
13 | Applications001={50ccee5b-973d-44cc-9d66-fbe506d9852b}
14 |
15 | [Default]
16 | OSInstall=Y
17 | OSDPrefix=PC
18 | MachineOULocation=Unknown
19 |
20 | [Hyper-V2008R2]
21 | OSDPrefix=VM
22 | MachineOULocation=VMs
23 | DoNotCreateExtraPartition=YES
24 |
25 | [HP EliteBook 8540w]
26 | OSDPrefix=HP
27 | MachineOULocation=LapTops
28 |
29 | [HP EliteBook 8460p]
30 | OSDPrefix=HP
31 | MachineOULocation=LapTops
32 |
33 | [SetOSD]
34 | OSDComputername=%OSDPrefix%-%MacAlias%
35 | MachineObjectOU=OU=%MachineOULocation%,OU=WorkStations,OU=ViaMonstra,DC=corp,DC=viamonstra,DC=com
36 |
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Settings based on VB Calculation.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=Default
3 | Properties=MyCustomProperty,MikeName
4 |
5 | [Default]
6 | OSInstall=Y
7 | OSDComputername=PC-#Left("%SerialNumber%",7)#
8 | MikeName=Mike-%OSDComputername%
9 |
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Settings based on Virtual Machines.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=ByVMType, Default
3 | Properties=MyCustomProperty
4 |
5 | [Default]
6 | OSInstall=NO
7 |
8 | [ByVMType]
9 | Subsection=IsVM-%ISVM%
10 |
11 | [IsVM-True]
12 | OSInstall=Y
13 | DoNotCreateExtraPartition=YES
14 | OSDComputername=VDI-#Left("%SerialNumber%",12)#
15 |
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Settings for UDI.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=Default, DefaultGateWay
3 | Properties=MyCustomProperty
4 |
5 | [Default]
6 | OSInstall=Y
7 | OSDAddAdmin=VIAMONSTRA\Support
8 | OSDDomainName=corp.viamonstra.com
9 | OSDJoinAccount=VIAMONSTRA\CM_JD
10 | OSDJoinPassword=P@ssw0rd
11 |
12 | [DefaultGateWay]
13 | 192.168.29.129=STOCKHOLM
14 | 192.168.133.1=STOCKHOLM
15 | 192.168.28.129=REDMOND
16 |
17 | [STOCKHOLM]
18 | UserLocale=sv-se
19 | UILanguage=sv-se
20 | KeyboardLocale=041d:0000041d
21 | TimeZoneName=W. Europe Standard Time
22 | OSDComputername=PC-STH-#Left("%SerialNumber%",8)#
23 | OSDDomainOUNameOU=Stockholm,OU=WorkStations,OU=ViaMonstra,DC=corp,DC=viamonstra,DC=com
24 | OSDLocalAdminPassword=TheStockholmSecretPassword
25 |
26 | [REDMOND]
27 | UserLocale=en-us
28 | UILanguage=en-us
29 | KeyboardLocale=0409:00000409
30 | TimeZoneName=Pacific Standard Time
31 | OSDComputername=PC-RED-#Left("%SerialNumber%",8)#
32 | OSDDomainOUNameOU=Redmond,OU=WorkStations,OU=ViaMonstra,DC=corp,DC=viamonstra,DC=com
33 | OSDLocalAdminPassword=TheRedmondSecretPassword
34 |
--------------------------------------------------------------------------------
/Tools/CSDemo/Samples/Using the SMSTSOrg.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=Default, DefaultGateWay
3 | Properties=Bunny, MyCustomProperty
4 |
5 | [Default]
6 | _SMSTSOrgName=Deploying %TaskSequenceID% to %OSDComputername%
7 | OSInstall=NO
8 | SkipAppsOnUpgrade=YES
9 | SkipCapture=NO
10 | SkipAdminPassword=YES
11 | SkipProductKey=YES
12 | UserDomain=CORP
13 | UserID=BuildAccount
14 | UserPassword=Password01
15 | OSDComputername=PC-#Left("%SerialNumber%",12)#
16 |
--------------------------------------------------------------------------------
/Tools/CSDemo/test.cmd:
--------------------------------------------------------------------------------
1 | cls
2 | del C:\MININT\SMSOSD\OSDLOGS\BDD.log
3 | del C:\MININT\SMSOSD\OSDLOGS\variables.dat
4 | cscript \\%COMPUTERNAME%\MDTLab$\Scripts\ZTIGather.wsf %1 %2 %3 %4 %5
5 |
6 |
--------------------------------------------------------------------------------
/Tools/Check-VIAApprovedModel/Check-VIAApprovedModel.ps1:
--------------------------------------------------------------------------------
1 | Param(
2 | $Model = 'Surface Pro 4',
3 | $OperatingSystem = 'Windows10x64'
4 | )
5 |
6 | $XMLFile = 'http://demohost03/ApprovedModelList/VIAApprovedModel.xml'
7 |
8 | Function Check-VIAApprovedModel{
9 | Param(
10 | $XMLFile,
11 | $Model,
12 | $OperatingSystem
13 | )
14 |
15 | [xml]$XMLData = (New-Object System.Net.WebClient).DownloadString($XMLFile)
16 | #[xml]$XMLData = Get-Content $XMLFile -ErrorAction Stop
17 | $ModelData = $XMLData.Models.Model | Where-Object Name -EQ $Model
18 |
19 | if(!($ModelData.$OperatingSystem -eq 'True')){
20 | RETURN $False
21 | }else{
22 | RETURN $ModelData.$OperatingSystem
23 | }
24 | }
25 |
26 | $result = Check-VIAApprovedModel -XMLFile $xmlfile -Model $Model -OperatingSystem $OperatingSystem
27 | if($result -eq $True){
28 | Write-Host - "Approved"
29 | Exit 0
30 | }else{
31 | Write-Host - "Not Approved"
32 | Exit 1
33 | }
34 |
--------------------------------------------------------------------------------
/Tools/Check-VIAApprovedModel/VIAApprovedModel.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | True
4 | True
5 | True
6 | True
7 | True
8 | True
9 | True
10 | True
11 | True
12 | True
13 | True
14 | True
15 |
16 |
17 | False
18 | False
19 | False
20 | True
21 | False
22 | False
23 | False
24 | True
25 | False
26 | False
27 | False
28 | False
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Tools/Configure - Windows Client/AppxProvisionedPackage.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeploymentBunny/Files/8eb059298667730ab6170c6c111aa9bdf4a5a723/Tools/Configure - Windows Client/AppxProvisionedPackage.txt
--------------------------------------------------------------------------------
/Tools/Configure - Windows Client/Startmenu.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Tools/Configure-DisableServicesforWindowsServer/Configure-DisableServicesforWindowsServer.ps1:
--------------------------------------------------------------------------------
1 | #Disable unneeded services in Windows Server 2016 Desktop Edition
2 | $Services = 'CDPUserSvc','MapsBroker','PcaSvc','ShellHWDetection','OneSyncSvc','WpnService'
3 |
4 | foreach($Service in $Services){
5 | Stop-Service -Name $Service -PassThru -Verbose | Set-Service -StartupType Disabled -Verbose
6 | }
7 |
8 |
--------------------------------------------------------------------------------
/Tools/Connect-VIARDP/ConnectVIARDP.psm1:
--------------------------------------------------------------------------------
1 | Function Connect-VIARDP {
2 | <#
3 | .Synopsis
4 | Connect-VIARDP
5 | .DESCRIPTION
6 | Connect-VIARDP
7 | .EXAMPLE
8 | Connect-VIARDP -Connection SERVER01
9 | .NOTES
10 | Created: July 15, 2016
11 | Version: 1.0
12 |
13 | Updated: Nov 25, 2016
14 | Version: 1.1
15 |
16 | Author - Mikael Nystrom
17 | Twitter: @mikael_nystrom
18 | Blog : http://deploymentbunny.com
19 |
20 | Disclaimer:
21 | This script is provided 'AS IS' with no warranties, confers no rights and
22 | is not supported by the author.
23 | .LINK
24 | http://www.deploymentbunny.com
25 | #>
26 | Param
27 | (
28 | [Parameter(Mandatory=$true,
29 | ValueFromPipelineByPropertyName=$true,
30 | Position=0)]
31 | $Connection
32 | )
33 | do
34 | {
35 | $ConTest = (Test-NetConnection -ComputerName $Connection -CommonTCPPort RDP).TcpTestSucceeded
36 | }
37 | until ($ConTest -eq "True")
38 | mstsc.exe /v:$Connection
39 | }
40 |
--------------------------------------------------------------------------------
/Tools/Convert-WIM2VHD/Convert-WIM2VHD.ps1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeploymentBunny/Files/8eb059298667730ab6170c6c111aa9bdf4a5a723/Tools/Convert-WIM2VHD/Convert-WIM2VHD.ps1
--------------------------------------------------------------------------------
/Tools/Create-ADUserDemo/ImportUsers.ps1:
--------------------------------------------------------------------------------
1 | #Read data from Bootstrap XML
2 | $settings = "C:\setup\Files\Tools\Create-ADUserDemo\settings.xml"
3 | [xml]$settings = Get-Content $BootstrapFile -ErrorAction Stop
4 |
5 | $Users = $settings.Settings.Users.User | Where-Object -Property Active -EQ $True
6 | Foreach($User in $Users){
7 | $User
8 | }
9 |
--------------------------------------------------------------------------------
/Tools/Create-ADUserDemo/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | False
5 | Mikael
6 | Nyström
7 |
8 |
9 | True
10 | Markus
11 | Lassfolk
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Tools/Create-MDTEvents/CreateEvent.ps1:
--------------------------------------------------------------------------------
1 | $MDTServer='DEMOHOST03:9800'
2 | $MessageID = '41015'
3 |
4 | $i = 1000
$ary = 1000..1025
do
{
$ary[$i]
$i++
Write-Host "PC0$i"
$mac = $i.ToString()
$mac
$mac = $mac.Substring(0,2)+":"+$mac.Substring(2,2)
$mac
$MacAddress = "00:15:5D:00:$mac"
5 | $MacAddress
6 | $ComputerName = "PC0$i"
7 | $guid = [guid]::NewGuid()
8 | $guid
9 |
10 | Invoke-WebRequest "http://$MDTServer/MDTMonitorEvent/PostEvent?uniqueID=&computerName=$ComputerName&messageID=$messageID&severity=1&stepName=¤tStep=10&totalSteps=10&id=$guid,$macaddress&message=Deployment Completed.&dartIP=&dartPort=&dartTicket=&vmHost=WIN-QJG36OC866D&vmName=CM2012SP1STDDEP-PC0003" | Out-Null
# Start-Sleep 10
}
11 | while ($i -lt 1025)
12 |
13 |
--------------------------------------------------------------------------------
/Tools/Create-VIAComputerName/Create-VIAComputerName.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Create-VIAComputerName
4 | .DESCRIPTION
5 | Create-VIAComputerName
6 | .PARAMETER ComputerPrefix
7 | String that defines the prefix of the computername to be generated
8 | .PARAMETER LowNumber
9 | Integer the defines the starting number
10 | .PARAMETER HigNumber
11 | Integer the defines the ending number
12 | .EXAMPLE
13 | Create-VIAComputerName -ComputerPrefix SERVER- -LowNumber 1 -HigNumber 10
14 |
15 | The command will return the following
16 | SERVER-001
17 | SERVER-002
18 | SERVER-003
19 | SERVER-004
20 | SERVER-005
21 | SERVER-006
22 | SERVER-007
23 | SERVER-008
24 | SERVER-009
25 | SERVER-010
26 | .NOTES
27 | Created: Nov 4, 2016
28 | Version: 1.0
29 |
30 | Author - Mikael Nystrom
31 | Twitter: @mikael_nystrom
32 | Blog : http://deploymentbunny.com
33 |
34 | Disclaimer:
35 | This script is provided "AS IS" with no warranties, confers no rights and
36 | is not supported.
37 | .LINK
38 | http://www.deploymentbunny.com
39 | #>
40 | function Create-VIAComputerName
41 | {
42 | Param
43 | (
44 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=0)]
45 | [String]
46 | $ComputerPrefix,
47 |
48 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=1)]
49 | [int]
50 | $LowNumber,
51 |
52 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=2)]
53 | [int]
54 | $HigNumber
55 | )
56 |
57 | $Servers = $($LowNumber..$HigNumber| ForEach-Object {"$ComputerPrefix{0:D3}" -f $_})
58 | Return $Servers
59 | }
60 |
61 |
62 |
--------------------------------------------------------------------------------
/Tools/Custom-ZTITatoo/CustomSettings.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=MacAddress,Default
3 | Properties=ViaClass,ViaRole,ViaTag,ViaOwner
4 |
5 | [Default]
6 | OSInstall=Y
7 |
8 | [00:15:01:02:03:04:05:06]
9 | ViaClass=DEMO
10 | ViaRole=Standard
11 | ViaTag=SupportPRIO
12 | ViaOwner=mikael.nystrom@viamonstra.com
13 |
--------------------------------------------------------------------------------
/Tools/Custom-ZTITatoo/ReadMe.txt:
--------------------------------------------------------------------------------
1 | This is a custom version of the ZTITatoo included in MDT. Use this as a template instead of modifying the ZTITatoo file in MDT, since it will be overwritten during upgrades.
2 |
--------------------------------------------------------------------------------
/Tools/Custom-ZTITatoo/ViaMonstraTatoo.mof:
--------------------------------------------------------------------------------
1 |
2 | //==================================================================
3 | // Register Registry property provider (shipped with WMI)
4 | // Refer to WMI SDK documentation for use
5 | //==================================================================
6 |
7 | #pragma namespace("\\\\.\\root\\cimv2")
8 |
9 | // Registry instance provider
10 | instance of __Win32Provider as $InstProv
11 | {
12 | Name ="RegProv" ;
13 | ClsID = "{fe9af5c0-d3b6-11ce-a5b6-00aa00680c3f}" ;
14 | ImpersonationLevel = 1;
15 | PerUserInitialization = "False";
16 | };
17 |
18 | instance of __InstanceProviderRegistration
19 | {
20 | Provider = $InstProv;
21 | SupportsPut = True;
22 | SupportsGet = True;
23 | SupportsDelete = False;
24 | SupportsEnumeration = True;
25 | };
26 |
27 |
28 | // Registry property provider
29 | instance of __Win32Provider as $PropProv
30 | {
31 | Name ="RegPropProv" ;
32 | ClsID = "{72967901-68EC-11d0-B729-00AA0062CBB7}";
33 | ImpersonationLevel = 1;
34 | PerUserInitialization = "False";
35 | };
36 |
37 | instance of __PropertyProviderRegistration
38 | {
39 | Provider = $PropProv;
40 | SupportsPut = True;
41 | SupportsGet = True;
42 | };
43 |
44 |
45 | //==================================================================
46 | // ViaMonstra Information class and instance definition
47 | //==================================================================
48 |
49 | #pragma namespace ("\\\\.\\root\\cimv2")
50 |
51 | // Class definition
52 |
53 | #pragma deleteclass("ViaMonstra_Info",nofail)
54 | [DYNPROPS]
55 | class ViaMonstra_Info
56 | {
57 | [key]
58 | string InstanceKey;
59 | string ViaClass;
60 | string ViaRole;
61 | string ViaTag;
62 | string ViaOwner;
63 |
64 | };
65 |
66 |
67 | // Instance definition
68 |
69 | [DYNPROPS]
70 | instance of ViaMonstra_Info
71 | {
72 | InstanceKey = "@";
73 |
74 | [PropertyContext("local|HKEY_LOCAL_MACHINE\\Software\\ViaMonstra\\OSD|ViaClass"), Dynamic, Provider("RegPropProv")]
75 | ViaClass;
76 |
77 | [PropertyContext("local|HKEY_LOCAL_MACHINE\\Software\\ViaMonstra\\OSD|ViaRole"), Dynamic, Provider("RegPropProv")]
78 | ViaRole;
79 |
80 | [PropertyContext("local|HKEY_LOCAL_MACHINE\\Software\\ViaMonstra\\OSD|ViaTag"), Dynamic, Provider("RegPropProv")]
81 | ViaTag;
82 |
83 | [PropertyContext("local|HKEY_LOCAL_MACHINE\\Software\\ViaMonstra\\OSD|ViaOwner"), Dynamic, Provider("RegPropProv")]
84 | ViaOwner;
85 | };
86 |
--------------------------------------------------------------------------------
/Tools/Custom-ZTITatoo/ViaMonstraTatoo.wsf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
107 |
108 |
--------------------------------------------------------------------------------
/Tools/Disable-InternetAccess/Disable-InternetAccess.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | Created: 2017-06-02
3 | Version: 1.1
4 |
5 | Author : Peter Lofgren
6 | Twitter: @LofgrenPeter
7 | Blog : http://syscenramblings.wordpress.com
8 |
9 | Author : Mikael Nystrom
10 | Twitter: @mikael_nystrom
11 | Blog : http://www.deploymentbunny.com
12 |
13 | Disclaimer:
14 | This script is provided "AS IS" with no warranties, confers no rights and
15 | is not supported by the author
16 |
17 | Release notes
18 | 1.0 - Initial release (Peter Lofgren)
19 | 1.1 - Change from netsh.exe to native Powershell (Mikael Nystrom)
20 | 1.2 - Change from blocking the machine, to block AppxSvc
21 | #>
22 |
23 | param (
24 | [Parameter(Mandatory=$False,Position=0)]
25 | [Switch]$Disable
26 | )
27 |
28 | If (!$Disable) {
29 | Write-Output "Adding internet block for AppXSvc"
30 | New-NetFirewallRule -DisplayName "Block Outgoing 80, 443 for AppXSvc" -Enabled True -Direction Outbound -Profile Any -Action Block -Protocol TCP -RemotePort 80,443 -Service AppXSvc
31 | }
32 |
33 | if ($Disable) {
34 | Write-Output "Adding internet block for AppXSvc"
35 | Get-NetFirewallRule -DisplayName "Block Outgoing 80, 443 AppXSvc" | Remove-NetFirewallRule
36 | }
--------------------------------------------------------------------------------
/Tools/Disable-ServerApps/Disable-ServerApps.ps1:
--------------------------------------------------------------------------------
1 | $Services = 'CDPUserSvc','MapsBroker','PcaSvc','ShellHWDetection','OneSyncSvc','WpnService'
2 |
3 | foreach($Service in $Services){
4 | Stop-Service -Name $Service -PassThru -Verbose | Set-Service -StartupType Disabled -Verbose
5 | }
6 |
7 |
--------------------------------------------------------------------------------
/Tools/Enable-NestedHyperV/EnableNestedHyperV.ps1:
--------------------------------------------------------------------------------
1 | Function Enable-NestedHyperV{
2 | Param(
3 | $VMname
4 | )
5 |
6 | $VM = Get-VM -Name $VMname
7 | $VMNic = Get-VMNetworkAdapter -VM $VM
8 | $VMCPU = Get-VMProcessor -VM $VM
9 |
10 | #Check if VM is saved
11 | if($VM.State -eq 'Saved'){Write-Warning "$VMname is saved, needs to be off";BREAK}
12 |
13 | #Check if VM has Snapshots
14 | if($VM.ParentSnapshotName -ne $null){Write-Warning "$VMname has snapshots, remove them";BREAK}
15 |
16 | #Check if VM is off
17 | if($VM.State -ne 'Off'){Write-Warning "$VMname is is not turned off, needs to be off";BREAK}
18 |
19 | #Check VM Configuration Version
20 | if($VM.Version -lt 7.0){Write-Warning "$VMname is not upgraded, needs to run VM Configuration 7.0";BREAK}
21 |
22 | #Check if VM allows Snapshot
23 | if($VM.CheckpointType -ne 'Disabled'){Write-Warning "$VMname allow Snapshot, Modifying";Set-VM -VM $VM -CheckpointType Disabled}
24 |
25 | #Check if VM has Dynamic Memory Enabled
26 | if($VM.DynamicMemoryEnabled -eq $true){Write-Warning "$VMname is set for Dynamic Memory, Modifying";Set-VMMemory -VM $VM -DynamicMemoryEnabled $false}
27 |
28 | #Check if VM has more then 4GB of RAM
29 | if($VM.MemoryStartup -lt 4GB){Write-Warning "$VMname has less then 4 GB of ram assigned, Modifying";Set-VMMemory -VM $VM -StartupBytes 4GB}
30 |
31 | #Check if VM has Mac Spoofing Enabled
32 | if(($VMNic).MacAddressSpoofing -ne 'On'){Write-Warning "$VMname does not have Mac Address Spoofing enabled, Modifying";Set-VMNetworkAdapter -VM $VM -MacAddressSpoofing on}
33 |
34 | #Check if VM has Expose Virtualization Extensions Enabled
35 | if(($VMCPU).ExposeVirtualizationExtensions -ne $true){Write-Warning "$VMname is not set to Expose Virtualization Extensions, Modifying";Set-VMProcessor -VM $VM -ExposeVirtualizationExtensions $true}
36 | }
--------------------------------------------------------------------------------
/Tools/Enable-NestedHyperV/EnableNestedHyperVSimple.ps1:
--------------------------------------------------------------------------------
1 | Function Enable-NestedHyperV{
2 | Param(
3 | $VMName
4 | )
5 | $VM = Get-VM -Name $VMName
6 | $VM | Set-VMProcessor -ExposeVirtualizationExtensions:$true
7 | $VM | Set-VMMemory -DynamicMemoryEnabled:$false
8 | $vm | Set-VM -CheckpointType Disabled
9 | Set-VMNetworkAdapter -VMName $VMName -MacAddressSpoofing on
10 | }
--------------------------------------------------------------------------------
/Tools/Enable-NestedHyperV/GetNestedHyperVRedniness.PS1:
--------------------------------------------------------------------------------
1 | Function Get-NestedHyperVRediness{
2 | $WindowsOptionalFeature = Get-WindowsOptionalFeature -Online
3 | if(($WindowsOptionalFeature | Where-Object -Property FeatureName -EQ -Value IsolatedUserMode).State -ne 'Disabled'){
4 | Write-Warning "Nested Hyper-V does not work if IsoLatedUserMode is Enabled"
5 | }
6 | Else
7 | {Write-Output "IsoLatedUserMode is set correct"}
8 |
9 | if(($WindowsOptionalFeature | Where-Object -Property FeatureName -EQ -Value HostGuardian).State -ne 'Disabled'){
10 | Write-Warning "Nested Hyper-v does not work if HostGuardian is Enabled"
11 | }
12 | Else
13 | {Write-Output "HostGuardian is set correct"}
14 |
15 | if(($WindowsOptionalFeature | Where-Object -Property FeatureName -EQ -Value Microsoft-Hyper-V).State -ne 'Enabled'){
16 | Write-Warning "Nested Hyper-v does not work if Microsoft-Hyper-V is Disabled"
17 | }
18 | Else
19 | {Write-Output "Microsoft-Hyper-V is installed"}
20 | }
--------------------------------------------------------------------------------
/Tools/Export-ModernDriverPackage/Export-ModernDriverPackage.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | # This script exports drivers from the machine you are running on, stores them in a folder and create a .CSV file that can be used to
3 | # import custom driver package for the Modern Driver Managment tool. http://www.scconfigmgr.com/modern-driver-management/
4 | #>
5 |
6 | Function Export-TSxWindowsDriver {
7 | Param(
8 | $Path,
9 | $Platform,
10 | $WindowsVersion,
11 | $Architecture,
12 | $Version
13 | )
14 | #ExportDriver
15 | $Make = (Get-WmiObject -Class Win32_Computersystem).Manufacturer
16 | switch ($Make)
17 | {
18 | 'HP'{
19 | $MakeAlias='Hewlett-Packard'
20 | $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystem).model
21 | $BaseBoard = (Get-CIMInstance -ClassName MS_SystemInformation -NameSpace root\WMI).BaseBoardProduct
22 | }
23 |
24 | 'Hewlett-Packard'{
25 | $MakeAlias=$Make
26 | $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystem).model
27 | $BaseBoard = (Get-CIMInstance -ClassName MS_SystemInformation -NameSpace root\WMI).BaseBoardProduct
28 | }
29 |
30 | 'LENOVO'{
31 | $MakeAlias=$Make
32 | $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystemProduct).version
33 | $BaseBoard = ((Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty Model).SubString(0, 4)).Trim()
34 | }
35 |
36 | 'Microsoft Corporation'{
37 | $MakeAlias='Microsoft'
38 | $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystem).model
39 | $BaseBoard = (Get-WmiObject -Class Win32_ComputerSystem).model
40 | }
41 | Default {}
42 | }
43 |
44 | New-Item -Path $Path -ItemType Directory -Force -ErrorAction Stop
45 | New-Item -Path $Path\$MakeAlias -ItemType Directory -Force -ErrorAction Stop
46 | New-Item -Path $Path\$MakeAlias\$ModelAlias -ItemType Directory -Force -ErrorAction Stop
47 | if((Test-Path -Path $Path) -ne $true){"Unable to access exportpath"}
48 |
49 | Export-WindowsDriver -Online -Destination $Path\$MakeAlias\$ModelAlias
50 | $items = Get-ChildItem -Path $Path\$MakeAlias\$ModelAlias -Filter PRN*
51 | foreach ($item in $items){
52 | Remove-Item -Path $item.fullname -Recurse -Force
53 | }
54 |
55 | $SourceDirectory = "$Path\$MakeAlias\$ModelAlias"
56 | Set-Content -Path $("$Path\$MakeAlias\$ModelAlias.csv") -Value "Make,Model,Baseboard,Platform,Operating System,Architecture,Version,Source Directory"
57 | Add-Content -Path $("$Path\$MakeAlias\$ModelAlias.csv") -Value "$MakeAlias,$ModelAlias,$BaseBoard,$Platform,$WindowsVersion,$Architecture,$Version,$SourceDirectory"
58 | }
59 |
60 | Export-TSxWindowsDriver -Path \\SCCM\Drivers$\W101709 -Platform ConfigMgr -WindowsVersion "Windows 10" -Version '1.0' -Architecture x64
61 |
--------------------------------------------------------------------------------
/Tools/GenOSDStatus/GenOSDStatus.ps1:
--------------------------------------------------------------------------------
1 | $URL = "http://EDUDEPLOY09:9801/MDTMonitorData/Computers"
2 |
3 | function GetMDTData {
4 | $Data = Invoke-RestMethod $URL
5 |
6 | foreach($property in ($Data.content.properties) ) {
7 | New-Object PSObject -Property @{
8 | Name = $($property.Name);
9 | PercentComplete = $($property.PercentComplete.’#text’);
10 | Warnings = $($property.Warnings.’#text’);
11 | Errors = $($property.Errors.’#text’);
12 | DeploymentStatus = $(
13 | Switch ($property.DeploymentStatus.’#text’) {
14 | 1 { "Active/Running" }
15 | 2 { "Failed" }
16 | 3 { "Successfully completed" }
17 | Default { "Unknown" }
18 | }
19 | );
20 | StartTime = $($property.StartTime.’#text’) -replace "T"," ";
21 | EndTime = $($property.EndTime.’#text’) -replace "T"," ";
22 | }
23 | }
24 | }
25 |
26 | $Head = ""
32 |
33 | $Title = "LabCenter Deployment Status"
34 |
35 | GetMDTData | Select Name, DeploymentStatus, PercentComplete, Warnings, Errors, StartTime, EndTime | Sort -Property Name |
36 | ConvertTo-Html `
37 | -Title $Title `
38 | -Head $Head `
39 | -Body (Get-Date -UFormat "%Y-%m-%d - %T ") `
40 | -PreContent "
LabCenter Deployment Status for: $ENV:COMPUTERNAME
Generated by Power of the Force
" `
41 | -PostContent "For details, contact support@truesec.se.
" `
42 | -Property Name,DeploymentStatus,PercentComplete,Warnings,Errors,StartTime |
43 | ForEach {
44 | if($_ -like "*Successfully completed | *"){$_ -replace "", "
"}
45 | elseif($_ -like "*Failed | *"){$_ -replace "
", "
"}
46 | else{$_}
47 | } > C:\inetpub\wwwroot\default.htm
48 | #Invoke-Item $ENV:TEMP\Default.htm
49 |
--------------------------------------------------------------------------------
/Tools/GenOSDStatusV2/GenOSDStatusV2.ps1:
--------------------------------------------------------------------------------
1 | $URL = "http://MDTSERVER:9801/MDTMonitorData/Computers"
2 | Import-Module C:\Tools\Script\MDTDB.psm1
3 | Connect-MDTDatabase -sqlServer MDTSERVER -instance MDT -database MDTPrd
4 |
5 | function GetMDTData {
6 | $Data = Invoke-RestMethod $URL
7 |
8 | foreach($property in ($Data.content.properties) ) {
9 | New-Object PSObject -Property @{
10 | Name = $($property.Name);
11 | Role = $(
12 | $OSDComputerName = $property.Name
13 | $Role = Get-MDTComputer | Where-Object OSDComputerName -EQ $OSDComputerName | Get-MDTComputerRole
14 | $Role.Role
15 | );
16 | PercentComplete = $($property.PercentComplete.’#text’);
17 | Warnings = $($property.Warnings.’#text’);
18 | Errors = $($property.Errors.’#text’);
19 | DeploymentStatus = $(
20 | Switch ($property.DeploymentStatus.’#text’) {
21 | 1 { "Active/Running" }
22 | 2 { "Failed" }
23 | 3 { "Successfully completed" }
24 | Default { "Unknown" }
25 | }
26 | );
27 | StartTime = $($property.StartTime.’#text’) -replace "T"," ";
28 | EndTime = $($property.EndTime.’#text’) -replace "T"," ";
29 | }
30 | }
31 | }
32 |
33 | $Head = ""
39 |
40 | $Title = "Customer Deployment Status"
41 |
42 | GetMDTData | Select Name, Role, DeploymentStatus, PercentComplete, Warnings, Errors, StartTime, EndTime | Sort -Property Name |
43 | ConvertTo-Html `
44 | -Title $Title `
45 | -Head $Head `
46 | -Body (Get-Date -UFormat "%Y-%m-%d - %T ") `
47 | -PreContent "Customer Deployment Status for: $ENV:COMPUTERNAME
Generated by Power of the Force
" `
48 | -PostContent "For details, contact support@customer.com.
" `
49 | -Property Name,Role,DeploymentStatus,PercentComplete,Warnings,Errors,StartTime |
50 | ForEach {
51 | if($_ -like "*Successfully completed | *"){$_ -replace "
", "
"}
52 | elseif($_ -like "*Failed | *"){$_ -replace "
", "
"}
53 | else{$_}
54 | } > C:\inetpub\wwwroot\default.htm
55 |
56 |
--------------------------------------------------------------------------------
/Tools/Get-ADHealthCheck/Get-ADHealthCheck.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Script from TechDays Sweden 2016
4 | .DESCRIPTION
5 | Script from TechDays Sweden 2016
6 | .NOTES
7 | Author - Mikael Nystrom
8 | Twitter: @mikael_nystrom
9 | Blog : http://deploymentbunny.com
10 | Disclaimer:
11 | This script is provided "AS IS" with no warranties, confers no rights and
12 | is not supported by the authors or Deployment Artist.
13 | .LINK
14 | http://www.deploymentbunny.com
15 | #>
16 | $getForest = [system.directoryservices.activedirectory.Forest]::GetCurrentForest()
17 | $DCServers = $getForest.Domains.DomainControllers.name
18 |
19 | foreach ($DCServer in $DCServers){
20 | Write-Host "Checking netaccess to $DCServer" -ForegroundColor Green
21 | Test-NetConnection -ComputerName $DCServer
22 |
23 | Write-Host "Checking Services that should be running on $DCServer" -ForegroundColor Green
24 | Invoke-Command -ComputerName $DCServer -ScriptBlock {
25 | $Services = Get-Service
26 | Foreach($Service in $Services | Where-Object -Property StartType -EQ Automatic){
27 | $Service | Where-Object -Property Status -NE -Value Running
28 | }
29 | }
30 |
31 | Write-Host "Getting debug logs on $DCServer" -ForegroundColor Green
32 | Invoke-Command -ComputerName $DCServer -ScriptBlock {
33 | Write-Host "C:\Windows\debug\PASSWD.LOG on $DCServer says:" -ForegroundColor Green
34 | Get-Content C:\Windows\debug\PASSWD.LOG
35 | }
36 |
37 | Write-Host "Getting debug logs on $DCServer" -ForegroundColor Green
38 | Invoke-Command -ComputerName $DCServer -ScriptBlock {
39 | Write-Host "C:\Windows\debug\netlogon.log on $DCServer says:" -ForegroundColor Green
40 | Get-Content C:\Windows\debug\netlogon.log
41 | }
42 |
43 | Write-Host "Running DCDiag on $DCServer" -ForegroundColor Green
44 | Invoke-Command -ComputerName $DCServer -ScriptBlock {
45 | dcdiag.exe /test:netlogons /Q
46 | dcdiag.exe /test:Services /Q
47 | dcdiag.exe /test:Advertising /Q
48 | dcdiag.exe /test:FSMOCheck /Q
49 | }
50 |
51 | Write-Host "Checking access to SYSVOL on $DCServer" -ForegroundColor Green
52 | Test-Path -Path \\$DCServer\sysvol
53 |
54 | Write-Host "Get 20 last errors/warning on $DCServer" -ForegroundColor Green
55 | Invoke-Command -ComputerName $DCServer -ScriptBlock {
56 | Get-EventLog -LogName Application -Newest 20 -EntryType Error,Warning | Select-Object Source,Message,TimeGenerated
57 | }
58 |
59 | Write-Host "Running BPA on $DCServer" -ForegroundColor Green
60 | Invoke-Command -ComputerName $DCServer -ScriptBlock {
61 | $BPA = "Microsoft/Windows/DirectoryServices"
62 | Invoke-BpaModel -BestPracticesModelId $BPA
63 | Get-BpaResult -ModelID $BPA -Filter Noncompliant | Select-Object ResultNumber,Severity,Category,Title,Problem,Impact,Resolution
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/Tools/Get-AllC++Runtimes/Get-Downloads.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | ##################################################################################
3 | # Script name: DownloadAllVC++.ps1
4 | # Created: 2012-12-26
5 | # version: v1.0
6 | # Author: Mikael Nystrom
7 | # Homepage: https://deploymentbunny.com/2014/08/05/powershell-is-king-download-all-vc-runtimes-using-a-script/
8 | ##################################################################################
9 |
10 | ##################################################################################
11 | # Disclaimer:
12 | # -----------
13 | # This script is provided "AS IS" with no warranties, confers no rights and
14 | # is not supported by the authors or DeploymentBunny.
15 | ##################################################################################
16 | #>
17 | Param(
18 | [Parameter(mandatory=$false,HelpMessage="Name and path of XML file")]
19 | [ValidateNotNullOrEmpty()]
20 | $DownloadFile = '.\download.xml',
21 |
22 | [Parameter(mandatory=$False,HelpMessage="Name and path of download folder")]
23 | [ValidateNotNullOrEmpty()]
24 | $DownloadFolder = 'C:\Downloads'
25 | )
26 | Function Logit()
27 | {
28 | $TextBlock1 = $args[0]
29 | $TextBlock2 = $args[1]
30 | $TextBlock3 = $args[2]
31 | $Stamp = Get-Date
32 | Write-Host "[$Stamp] [$Section - $TextBlock1]"
33 | }
34 |
35 | # Main
36 | $Section = "Main"
37 | Logit "DownLoadFolder - $DownLoadFolder"
38 | Logit "DownloadFile - $DownloadFile"
39 |
40 | #Read content
41 | $Section = "Reading datafile"
42 | Logit "Reading from $DownloadFile"
43 | [xml]$Data = Get-Content $DownloadFile
44 | $TotalNumberOfObjects = $Data.Download.DownloadItem.Count
45 |
46 | # Start downloading
47 | $Section = "Downloading"
48 | Logit "Downloading $TotalNumberOfObjects objects"
49 | $Count = (0)
50 | foreach($DataRecord in $Data.Download.DownloadItem)
51 | {
52 | $FullName = $DataRecord.FullName
53 | $Count = ($Count + 1)
54 | $Source = $DataRecord.Source
55 | $DestinationFolder = $DataRecord.DestinationFolder
56 | $DestinationFile = $DataRecord.DestinationFile
57 | Logit "Working on $FullName ($Count/$TotalNumberOfObjects)"
58 | $DestinationFolder = $DownloadFolder + "\" + $DestinationFolder
59 | $Destination = $DestinationFolder + "\" + $DestinationFile
60 | $Downloaded = Test-Path $Destination
61 | if($Downloaded -like 'True'){}
62 | else
63 | {
64 | Logit "$DestinationFile needs to be downloaded."
65 | Logit "Creating $DestinationFolder"
66 | New-Item -Path $DestinationFolder -ItemType Directory -Force | Out-Null
67 | Logit "Downloading $Destination"
68 | Try
69 | {
70 | Start-BitsTransfer -Destination $Destination -Source $Source -Description "Download $FullName" -ErrorAction Continue
71 | }
72 | Catch
73 | {
74 | $ErrorMessage = $_.Exception.Message
75 | Logit "Fail: $ErrorMessage"
76 | }
77 | }
78 | }
79 |
80 | # Start Proccessing downloaded files
81 | $Section = "Process files"
82 | Logit "Checking $TotalNumberOfObjects objects"
83 | $Count = (0)
84 | foreach($DataRecord in $Data.Download.DownloadItem){
85 | $CommandType = $DataRecord.CommandType
86 | if($CommandType -like 'NONE')
87 | {}
88 | else
89 | {
90 | $FullName = $DataRecord.FullName
91 | $Count = ($Count + 1)
92 | $Source = $DataRecord.Source
93 | $Command = $DataRecord.Command
94 | $CommandLineSwitches = $DataRecord.CommandLineSwitches
95 | $VerifyAfterCommand = $DataRecord.VerifyAfterCommand
96 | $DestinationFolder = $DataRecord.DestinationFolder
97 | $DestinationFile = $DataRecord.DestinationFile
98 | $DestinationFolder = $DownLoadFolder + "\" + $DestinationFolder
99 | $Destination = $DestinationFolder + "\" + $DestinationFile
100 | $CheckFile = $DestinationFolder + "\" + $VerifyAfterCommand
101 | Logit "Working on $FullName ($Count/$TotalNumberOfObjects)"
102 | Logit "Looking for $CheckFile"
103 | $CommandDone = Test-Path $CheckFile
104 | if($CommandDone -like 'True')
105 | {
106 | Logit "$FullName is already done"
107 | }
108 | else
109 | {
110 | Logit "$FullName needs to be fixed."
111 | #Selecting correct method to extract data
112 | Switch($CommandType){
113 | EXEType01{
114 | $Command = $DestinationFolder + "\" + $Command
115 | $DownLoadProcess = Start-Process """$Command""" -ArgumentList ($CommandLineSwitches + " " + """$DestinationFolder""") -Wait
116 | $DownLoadProcess.HasExited
117 | $DownLoadProcess.ExitCode
118 | }
119 | NONE{
120 | }
121 | default{
122 | }
123 | }
124 | }
125 | }
126 | }
127 |
128 | #Done
129 | $Section = "Finish"
130 | Logit "All Done"
131 |
--------------------------------------------------------------------------------
/Tools/Get-AllC++Runtimes/RunMe.ps1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeploymentBunny/Files/8eb059298667730ab6170c6c111aa9bdf4a5a723/Tools/Get-AllC++Runtimes/RunMe.ps1
--------------------------------------------------------------------------------
/Tools/Get-DHCPHealthCheck/Get-DHCPHealthCheck.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Script from TechDays Sweden 2016
4 | .DESCRIPTION
5 | Script from TechDays Sweden 2016
6 | .NOTES
7 | Author - Mikael Nystrom
8 | Twitter: @mikael_nystrom
9 | Blog : http://deploymentbunny.com
10 | Disclaimer:
11 | This script is provided "AS IS" with no warranties, confers no rights and
12 | is not supported by the authors or Deployment Artist.
13 | .LINK
14 | http://www.deploymentbunny.com
15 | #>
16 | $DHCPServers = "SRVDC01.network.local"
17 | Foreach($DHCPServer in $DHCPServers){
18 | Write-Host "Checking netaccess to $DCServer" -ForegroundColor Green
19 | Test-Connection -ComputerName $DCServer
20 |
21 |
22 | Invoke-Command -ComputerName $DCServer -ScriptBlock {
23 | Write-Host "Getting other DCHP/PXE Servers from $env:COMPUTERNAME" -ForegroundColor Green
24 | $DhcpServerInDCs = Get-DhcpServerInDC
25 | $DhcpServerInDCs
26 |
27 | Write-Host "Testing access to other DCHP/PXE Servers from $env:COMPUTERNAME" -ForegroundColor Green
28 | Foreach($DhcpServerInDC in $DhcpServerInDCs){
29 | Write-Host "Testing access to $($DhcpServerInDC.IPAddress)" -ForegroundColor Green
30 | Test-NetConnection -ComputerName $DhcpServerInDC.IPAddress
31 | }
32 | }
33 |
34 | Invoke-Command -ComputerName $DCServer -ScriptBlock {
35 | Write-Host "Get all Scopes from $env:COMPUTERNAME" -ForegroundColor Green
36 | $DhcpServerv4Scopes = Get-DhcpServerv4Scope
37 | Foreach($DhcpServerv4Scope in $DhcpServerv4Scopes){
38 | $DhcpServerv4Scope
39 | Write-Host "Percent free $(($DhcpServerv4Scope | Get-DhcpServerv4ScopeStatistics).PercentageInUse) in $($DhcpServerv4Scope.scopeid)"
40 | }
41 | }
42 |
43 | Write-Host "Running BPA on $DHCPServer" -ForegroundColor Green
44 | Invoke-Command -ComputerName $DHCPServer -ScriptBlock {
45 | $BPA = "Microsoft/Windows/DHCPServer"
46 | Invoke-BpaModel -BestPracticesModelId $BPA
47 | Get-BpaResult -ModelID $BPA -Filter Noncompliant | Select-Object ResultNumber,Severity,Category,Title,Problem,Impact,Resolution
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Tools/Get-MDTOdata/GetMDTOdata.ps1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeploymentBunny/Files/8eb059298667730ab6170c6c111aa9bdf4a5a723/Tools/Get-MDTOdata/GetMDTOdata.ps1
--------------------------------------------------------------------------------
/Tools/Get-ReliabilityStabilityMetrics/Get-ReliabilityStabilityMetrics.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Script from TechDays Sweden 2016
4 | .DESCRIPTION
5 | Script from TechDays Sweden 2016
6 | .NOTES
7 | Author - Mikael Nystrom
8 | Twitter: @mikael_nystrom
9 | Blog : http://deploymentbunny.com
10 | Disclaimer:
11 | This script is provided "AS IS" with no warranties, confers no rights and
12 | is not supported by the authors or Deployment Artist.
13 | .LINK
14 | http://www.deploymentbunny.com
15 | #>
16 | Param(
17 | $ComputerNames
18 | )
19 | Function Get-RemoteComputerSystemInfo{
20 | param(
21 | $ComputerName
22 | )
23 |
24 | Invoke-Command -ComputerName $ComputerName -ScriptBlock {
25 | Function Get-ComputerSystemInfo{
26 | Write-Host "Getting data from $env:COMPUTERNAME"
27 | $Index = Get-WmiObject -Class Win32_ReliabilityStabilityMetrics | Select-Object @{N="TimeGenerated"; E={$_.ConvertToDatetime($_.TimeGenerated)}},SystemStabilityIndex | Select-Object -First 1
28 | $ComputerSystem = Get-WmiObject -Class Win32_ComputerSystem
29 | $OperatingSystem = Get-WmiObject -Class Win32_OperatingSystem | Select-Object @{N="LastBootUpTime"; E={$_.ConvertToDatetime($_.LastBootUpTime)}},Version
30 | $Plupp = [ordered]@{
31 | ComputerName = $($env:COMPUTERNAME)
32 | Index = $([math]::Round($Index.SystemStabilityIndex))
33 | TimeGenerated = $($Index.TimeGenerated)
34 | Make = $($ComputerSystem.Manufacturer)
35 | Model = $($ComputerSystem.Model)
36 | OSVersion = $($OperatingSystem.Version)
37 | UpTimeInDays = $([math]::round(((Get-Date) - ($OperatingSystem.LastBootUpTime)).TotalDays))
38 | OSDiskFreeSpaceInGB = $([Math]::Round($(((Get-Volume -DriveLetter C).SizeRemaining)/1GB),2))
39 | }
40 | New-Object PSObject -Property $Plupp
41 | }
42 | Get-ComputerSystemInfo
43 | }
44 | }
45 |
46 | #Get the servers
47 | Write-Host "Getting Server names"
48 | Import-Module "ActiveDirectory"
49 | $Computers = Get-ADComputer -LDAPFilter "(&(objectCategory=computer)(name=$ComputerNames)(!serviceprincipalname=*MSClusterVirtualServer*)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))"
50 |
51 | Write-Host "Found $($Computers.Count)"
52 | Write-Host "Check if they are online"
53 | $ComputersOnline = $Computers.DNShostname | Test-NetConnection -CommonTCPPort WINRM -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Where-Object -Property TcpTestSucceeded -EQ -Value True
54 | Write-Host "Found $($ComputersOnline.Count) that seems to be online"
55 |
56 | $TheSadTruth = Foreach($Computer in $ComputersOnline.ComputerName){
57 | Get-RemoteComputerSystemInfo -ComputerName $Computer
58 | }
59 |
60 | $Title = "Cloud"
61 | $Head = "Cloud"
62 | $TheSadTruth | Sort-Object -Property ComputerName | ConvertTo-Html -As Table `
63 | -Title $Title `
64 | -Head $Head `
65 | -Body (Get-Date -UFormat "%Y-%m-%d - %T ") `
66 | -PreContent "Rel Index from $ENV:USERDNSDOMAIN
Generated by Power of the Force
" `
67 | -PostContent "For details, contact support@customer.com.
" `
68 | -Property ComputerName,Make,Model,OSVersion,OSDiskFreeSpaceInGB,UpTimeInDays,Index |
69 | ForEach {
70 | if($_ -like "*10 | *"){$_ -replace "
", "
"}
71 | elseif($_ -like "*9 | *"){$_ -replace "
", "
"}
72 | elseif($_ -like "*8 | *"){$_ -replace "
", "
"}
73 | elseif($_ -like "*7 | *"){$_ -replace "
", "
"}
74 | elseif($_ -like "*6 | *"){$_ -replace "
", "
"}
75 | elseif($_ -like "*5 | *"){$_ -replace "
", "
"}
76 | elseif($_ -like "*4 | *"){$_ -replace "
", "
"}
77 | elseif($_ -like "*3 | *"){$_ -replace "
", "
"}
78 | elseif($_ -like "*2 | *"){$_ -replace "
", "
"}
79 | elseif($_ -like "*1 | *"){$_ -replace "
", "
"}
80 | elseif($_ -like "*0 | *"){$_ -replace "
", "
"}
81 | else{$_}
82 | } > C:\inetpub\wwwroot\default.htm
83 |
--------------------------------------------------------------------------------
/Tools/Get-VIAActiveDiffDisk/GetVIAActiveDiffDisk.ps1:
--------------------------------------------------------------------------------
1 | Function Get-VIAActiveDiffDisk{
2 | <#
3 | .Synopsis
4 | Script used to Deploy and Configure Fabric
5 | .DESCRIPTION
6 | Created: 2016-11-07
7 | Version: 1.0
8 | Author : Mikael Nystrom
9 | Twitter: @mikael_nystrom
10 | Blog : http://deploymentbunny.com
11 | Disclaimer: This script is provided "AS IS" with no warranties.
12 | .EXAMPLE
13 | Get-VIAActiveDiffDisk
14 | #>
15 | [CmdletBinding(SupportsShouldProcess=$true)]
16 | param(
17 | )
18 |
19 | $VMHardDiskDrives = Get-VMHardDiskDrive -VM (Get-VM)
20 | $ActiveDisks = foreach($VMHardDiskDrive in $VMHardDiskDrives){
21 | $Diffs = Get-VHD -Path $VMHardDiskDrive.Path | Where-Object -Property VhdType -EQ -Value Differencing
22 | $Diffs.ParentPath
23 | }
24 | $ActiveDisks | Sort-Object | Select-Object -Unique
25 | }
--------------------------------------------------------------------------------
/Tools/Get-VIADisconnectedVHDs/GetVIADisconnectedVHDs.psm1:
--------------------------------------------------------------------------------
1 | Function Get-VIADisconnectedVHDs
2 | {
3 | <#
4 | .Synopsis
5 | Script used find .VHD files that are not connected to VM's
6 | .DESCRIPTION
7 | Created: 2016-11-07
8 | Version: 1.0
9 | Author : Mikael Nystrom
10 | Twitter: @mikael_nystrom
11 | Blog : http://deploymentbunny.com
12 | Disclaimer: This script is provided "AS IS" with no warranties.
13 | .EXAMPLE
14 | Get-Get-VIADisconnectedVHDs
15 | #>
16 | [CmdletBinding(SupportsShouldProcess=$true)]
17 |
18 | Param(
19 | [string]$Folder
20 | )
21 |
22 | if((Test-Path -Path $Folder) -ne $true){
23 | Write-Warning "I'm sorry, that folder does not exist"
24 | Break
25 | }
26 |
27 | #Get the disk used by a VM
28 | $VMs = (Get-VM | Where-Object -Property ParentSnapshotName -EQ -Value $null).VMId
29 |
30 | if(($VMs.count) -eq '0'){
31 | Write-Information "Sorry, could not find any VM's"
32 | Break
33 | }
34 | $VHDsActive = foreach($VMsID in $VMs){
35 | Get-VMHardDiskDrive -VM (Get-VM -Id $VMsID)
36 | }
37 |
38 | #Get the disk in the folder
39 | $VHDsAll = Get-ChildItem -Path $Folder -Filter *.vhd* -Recurse
40 | if(($VHDsAll.count) -eq '0'){
41 | Write-Information "Sorry, could not find any VHD's in $folder"
42 | Break
43 | }
44 |
45 | $obj = Compare-Object -ReferenceObject $VHDsActive.Path -DifferenceObject $VHDsAll.FullName
46 |
47 | #Compare and give back the list of .vhd's that are not connected
48 | Return ($obj | Where-Object -Property SideIndicator -EQ -Value =>).InputObject
49 | }
--------------------------------------------------------------------------------
/Tools/Get-VIASCVMMDiskInfo/GetVIASCVMMDiskInfo.psm1:
--------------------------------------------------------------------------------
1 | Function Get-VIASCVMMDiskInfo{
2 | <#
3 | .Synopsis
4 | Get-VIASCVMMDiskInfo is a function that gets virtual harddisks from SCVMM.
5 | .DESCRIPTION
6 | Get-VIASCVMMDiskInfo is a function that gets virtual harddisks from SCVMM.
7 | It presents:
8 | VMName
9 | VMhost
10 | VMHostVolume
11 | VHDType
12 | VHDParentDisk
13 | VHDFormatType
14 | VHDLocation
15 | VHDMaxSize
16 | VHDCurrentSize
17 | VHDExpandedInPercent
18 | .EXAMPLE
19 | Get-VIASCVMMDiskInfo -VMName SERVER01 | Out-GridView
20 | .EXAMPLE
21 | Get-VIASCVMMDiskInfo | Out-GridView
22 | .NOTES
23 | Created: 2016-11-25
24 | Version: 1.0
25 |
26 | Author - Mikael Nystrom
27 | Twitter: @mikael_nystrom
28 | Blog : http://deploymentbunny.com
29 |
30 | Disclaimer:
31 | This script is provided 'AS IS' with no warranties, confers no rights and
32 | is not supported by the author.
33 |
34 |
35 | .LINK
36 | http://www.deploymentbunny.com
37 | #>
38 | Param(
39 | $VMName = ''
40 | )
41 |
42 | if($VMName -eq ''){$VMs = Get-SCVirtualMachine -All}
43 | if($VMName -ne ''){$VMs = Get-SCVirtualMachine -Name $VMName}
44 |
45 | foreach ($Obj in ($VMs | Select-Object ComputerNameString -ExpandProperty VirtualHardDisks)){
46 | $Data = [ordered]@{
47 | VMName = $($Obj.ComputerNameString);
48 | VMhost = $($Obj.VMHost);
49 | VMHostVolume = $($Obj.HostVolume);
50 | VHDType = $($Obj.VHDType);
51 | VHDParentDisk = $($Obj.ParentDisk);
52 | VHDFormatType = $($Obj.VHDFormatType);
53 | VHDLocation = $($Obj.Location);
54 | VHDMaxSize = "{0:N2}" -f $($Obj.MaximumSize/1GB);
55 | VHDCurrentSize = "{0:N2}" -f $($Obj.size/1GB);
56 | VHDExpandedInPercent="{0:P0}" -f $(($Obj.size/1GB)/($Obj.MaximumSize/1GB));
57 | }
58 | New-Object -TypeName PSObject -Property $Data
59 | }
60 | }
--------------------------------------------------------------------------------
/Tools/Get-VIAUnimportedvmcxFiles/GetVIAUnimportedvmcxFiles.psm1:
--------------------------------------------------------------------------------
1 | Function Get-VIAUnimportedvmcxFiles
2 | {
3 | <#
4 | .Synopsis
5 | Script used find not yet imported Hyper-V Configurations
6 | .DESCRIPTION
7 | Created: 2016-11-07
8 | Version: 1.0
9 | Author : Mikael Nystrom
10 | Twitter: @mikael_nystrom
11 | Blog : http://deploymentbunny.com
12 | Disclaimer: This script is provided "AS IS" with no warranties.
13 | .EXAMPLE
14 | Get-VIAUnimportedvmcxFiles
15 | #>
16 | [CmdletBinding(SupportsShouldProcess=$true)]
17 |
18 | Param(
19 | [string]$Folder
20 | )
21 |
22 | if((Test-Path -Path $Folder) -ne $true){
23 | Write-Warning "I'm sorry, that folder does not exist"
24 | Break
25 | }
26 |
27 | $VMsIDs = (Get-VM).VMId
28 | $VMConfigs = (Get-ChildItem -Path $Folder -Filter *.vmcx -Recurse).BaseName
29 |
30 | $obj = Compare-Object -ReferenceObject $VMsIDs -DifferenceObject $VMConfigs
31 |
32 | $Configs = foreach($Item in ($obj.InputObject)){
33 | $Items = Get-ChildItem -Path $Folder -Recurse -File -Filter *.vmcx | Where-Object -Property Basename -Like -Value "*$Item"
34 | $Items | Where-Object -Property FullName -NotLike -Value "*Snapshots*"
35 | }
36 | Return $Configs.FullName
37 | }
--------------------------------------------------------------------------------
/Tools/Get-VMHealthCheck/Get-VMHealthCheck.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Script from TechDays Sweden 2016
4 | .DESCRIPTION
5 | Script from TechDays Sweden 2016
6 | .NOTES
7 | Author - Mikael Nystrom
8 | Twitter: @mikael_nystrom
9 | Blog : http://deploymentbunny.com
10 | Disclaimer:
11 | This script is provided "AS IS" with no warranties, confers no rights and
12 | is not supported by the authors or Deployment Artist.
13 | .LINK
14 | http://www.deploymentbunny.com
15 | #>
16 | $HyperVHosts = "demohost03.network.local"
17 |
18 | Foreach($HyperVHost in $HyperVHosts){
19 | Write-Host "Checking netaccess to $HyperVHost" -ForegroundColor Green
20 | Test-Connection -ComputerName $HyperVHost
21 |
22 | Invoke-Command -ComputerName $HyperVHost -ScriptBlock {
23 | Write-Host "Base info:" -ForegroundColor Green
24 | $Win32_computersystem = Get-WmiObject -Class Win32_computersystem
25 | Write-Host "$($Win32_computersystem.Name), $($Win32_computersystem.Model), $("{0:N0}" -f ($Win32_computersystem.TotalPhysicalMemory/1GB)) GB"
26 | Get-Volume | FT
27 | Get-WmiObject -Class Win32_Processor | Select-Object Name | FT
28 | }
29 |
30 | Invoke-Command -ComputerName $HyperVHost -ScriptBlock {
31 | $VM = Get-VM
32 |
33 | Write-Host "The total number of VM's on this host is: ": -ForegroundColor Green
34 | $VM.Count
35 |
36 | Write-Host "The following VM's are running": -ForegroundColor Green
37 | $VM | Where-Object -Property State -EQ -Value Running | FT -AutoSize
38 |
39 | Write-Host "The following VM's have DiffDisks": -ForegroundColor Green
40 | $VMHardDiskDrives = $VM | Get-VMHardDiskDrive
41 | $VMsWithDiff = foreach($VMHardDiskDrive in $VMHardDiskDrives){
42 | if($VMHardDiskDrive.Path | Get-VHD | Where-Object -Property VhdType -EQ -Value Differencing){
43 | $VMHardDiskDrive.VMName
44 | }
45 | }
46 | $VMsWithDiff | FT -AutoSize
47 |
48 | Write-Host "The following DiffDisks are in use": -ForegroundColor Green
49 | $VMHardDiskDrives = $VM | Get-VMHardDiskDrive
50 | $DiffDisks = foreach($VMHardDiskDrive in $VMHardDiskDrives){
51 | if($VMHardDiskDrive.Path | Get-VHD | Where-Object -Property VhdType -EQ -Value Differencing){
52 | $VMHardDiskDrive.Path
53 | }
54 | }
55 | $DiffDisks | FT -AutoSize
56 |
57 | Write-Host "The following VM's have SnapShots": -ForegroundColor Green
58 | $VM | Get-VMSnapshot | FT -AutoSize
59 |
60 | Write-Host "Checking for NetAdapter issues": -ForegroundColor Green
61 | $VMNetworkAdapters = $VM | Get-VMNetworkAdapter
62 | $VMNetworkAdapters | Select-Object VMName,MacAddress,DynamicMacAddressEnabled,IsLegacy,SwitchName,Status,IPAddresses | FT -AutoSize
63 |
64 | Write-Host "Checking for CPU issues:" -ForegroundColor Green
65 | $VMProcessor = $VM | Get-VMProcessor
66 | $VMProcessor | Select-Object VMName,Count,CompatibilityForMigrationEnabled,CompatibilityForOlderOperatingSystemsEnabled,ExposeVirtualizationExtensions,OperationalStatus | FT -AutoSize
67 |
68 | Write-Host "Checking for Memory issues:" -ForegroundColor Green
69 | $VMMemory = $VM | Get-VMMemory
70 | $VMMemory | Select-Object VMName,DynamicMemoryEnabled,Startup, Minimum,Maximum | FT -AutoSize
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Tools/Get-WSUSHealthCheck/Get-WSUSHealthCheck.ps1:
--------------------------------------------------------------------------------
1 | $WSUSServers = "SRVWSUS02.network.local"
2 | Foreach($WSUSServer in $WSUSServers){
3 | Write-Host "Checking netaccess to $WSUSServer" -ForegroundColor Green
4 | Test-Connection -ComputerName $WSUSServer
5 |
6 | Invoke-Command -ComputerName $WSUSServer -ScriptBlock {
7 | Write-Host "Base info:" -ForegroundColor Gray
8 | Get-WsusServer | Select-Object *
9 | }
10 |
11 | Invoke-Command -ComputerName $WSUSServer -ScriptBlock {
12 | $enus = 'en-US' -as [Globalization.CultureInfo]
13 | $TimeToCheck = (get-date).AddDays(-10).ToString("M/d/yyyy hh:mm tt", $enus)
14 | $ComputersWNoReport = Get-WsusComputer -All | Where-Object -Property LastReportedStatusTime -LT -Value $TimeToCheck | Select-Object FullDomainName,Make,Model,LastSyncTime | FT
15 | Write-Host "The following computers have not reported to WSUS in 10 days..." -ForegroundColor Green
16 | $ComputersWNoReport
17 | }
18 |
19 | Invoke-Command -ComputerName $WSUSServer -ScriptBlock {
20 | Write-Host "The following updates are unapproved but needed" -ForegroundColor Green
21 | Get-WsusUpdate -Approval Unapproved -Status Needed
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tools/GetILOInfo/GetILOInfo.psm1:
--------------------------------------------------------------------------------
1 | Function Get-TSxiLOInfo {
2 | param(
3 | $ComputerName,
4 | [switch]$ResolveName
5 | )
6 | $XML = New-Object XML
7 | if($ResolveName){
8 | $HostName = Resolve-DnsName -Name $ComputerName
9 | }
10 | else{
11 | $HostName = "NA"
12 | }
13 |
14 | $XML.Load("http://$ComputerName/xmldata?item=All")
15 | New-Object PSObject -Property @{
16 | iLOName = $($HostName.NameHost);
17 | iLOIP = $($ComputerName);
18 | ServerType = $($XML.RIMP.HSI.SPN);
19 | SerialNumber = $($XML.RIMP.HSI.SBSN);
20 | ProductID = $($XML.RIMP.HSI.PRODUCTID);
21 | UUID = $($XML.RIMP.HSI.cUUID);
22 | Nic01 = $($XML.RIMP.HSI.NICS.NIC[0].MACADDR);
23 | Nic02 = $($XML.RIMP.HSI.NICS.NIC[1].MACADDR);
24 | ILOType = $($XML.RIMP.MP.PN);
25 | iLOFirmware = $($XML.RIMP.MP.FWRI)
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Tools/IMF-ConfigMgrImport/IMF-ConfigMgrImport.ps1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeploymentBunny/Files/8eb059298667730ab6170c6c111aa9bdf4a5a723/Tools/IMF-ConfigMgrImport/IMF-ConfigMgrImport.ps1
--------------------------------------------------------------------------------
/Tools/IdentityLifeCyleWoops/GetAdminCount.ps1:
--------------------------------------------------------------------------------
1 |
2 | # This sample will get all accounts that has been or are a member of some administrtative group with higher priviliges then a domain user
3 |
4 | Get-ADUser -Filter {admincount -GT 0} -Properties adminCount,LastLogonDate,PasswordNeverExpires,PwdLastSet |
5 | Select-Object Name,LastLogonDate,PasswordNeverExpires,@{Name='PwdLastSet';Expression={[DateTime]::FromFileTime($_.PwdLastSet)}} |
6 | Sort-Object | Format-Table
7 |
--------------------------------------------------------------------------------
/Tools/IdentityLifeCyleWoops/GetAllUsersEnabledAndPasswordNeverExpires.ps1:
--------------------------------------------------------------------------------
1 |
2 | # This will get all users where Password Never Expires is set to true and are enabled
3 |
4 | Get-ADUser -filter {passwordNeverExpires -EQ $true -and enabled -EQ $true } -Properties Name,LastLogonDate,PasswordNeverExpires,PwdLastSet |
5 | Select-Object Name,LastLogonDate,PasswordNeverExpires,@{Name='PwdLastSet';Expression={[DateTime]::FromFileTime($_.PwdLastSet)}} |
6 | Sort-Object | Format-Table
7 |
--------------------------------------------------------------------------------
/Tools/IdentityLifeCyleWoops/GetAllUsersintheDomainAdminGroup.ps1:
--------------------------------------------------------------------------------
1 |
2 | # This will get all users that are member of the Domain Admin group
3 |
4 | Get-ADGroupMember -Identity "Domain Admins" -Recursive |
5 | Get-ADUser -Properties Name,LastLogonDate,PasswordNeverExpires,PwdLastSet | Where-Object {$_.Enabled -eq $true} |
6 | Select-Object Name,LastLogonDate,PasswordNeverExpires,@{Name='PwdLastSet';Expression={[DateTime]::FromFileTime($_.PwdLastSet)}} |
7 | Sort-Object | Format-Table
--------------------------------------------------------------------------------
/Tools/Import-MDTApps/Import-MDTApps.ps1:
--------------------------------------------------------------------------------
1 | #Import Apps
2 | Param(
3 | [parameter(mandatory=$True,HelpMessage='Name of Appfolder')]
4 | $ImportFolder = "C:\MDTApps",
5 |
6 | [parameter(mandatory=$True,HelpMessage='Name of MDTfolder')]
7 | $MDTFolder = "C:\DeploymentShare"
8 |
9 | )
10 |
11 | #Load the MDT PS Module
12 | try
13 | {
14 | Import-Module "C:\Program Files\Microsoft Deployment Toolkit\bin\MicrosoftDeploymentToolkit.psd1"
15 | }
16 | catch
17 | {
18 | Write-Error 'The MDT PS module could not be loaded correctly, exit'
19 | Exit
20 | }
21 |
22 | if (!(test-path DS001:))
23 | {
24 | New-PSDrive -Name "DS001" -PSProvider MDTProvider -Root $MDTFolder
25 | }
26 |
27 | Function Import-MDTAppBulk{
28 | import-MDTApplication -path "DS001:\Applications" `
29 | -enable "True" `
30 | -Name $InstallLongAppName `
31 | -ShortName $InstallLongAppName `
32 | -Version "" `
33 | -Publisher "" `
34 | -Language "" `
35 | -CommandLine $CommandLine `
36 | -WorkingDirectory ".\Applications\$InstallLongAppName" `
37 | -ApplicationSourcePath $InstallFolder `
38 | -DestinationFolder $InstallLongAppName
39 | }
40 | $SearchFolders = get-childitem -Path $ImportFolder
41 | Foreach ($SearchFolder in $SearchFolders){
42 | foreach ($InstallFile in (Get-ChildItem -Path $SearchFolder.FullName *.wsf)){
43 | $Install = $InstallFile.Name
44 | $InstallFolder = $InstallFile.DirectoryName
45 | $InstallLongAppName = $InstallFolder | Split-Path -Leaf
46 | $InstallerType = $InstallFilet.Extension
47 | $CommandLine = "cscript.exe $Install"
48 | Write-Verbose "Installer is $Install"
49 | Write-Verbose "InstallFolder is $InstallFolder"
50 | Write-Verbose "InstallLongAppName is $InstallLongAppName"
51 | Write-Verbose "InstallCommand is $CommandLine"
52 | Write-Verbose ""
53 | . Import-MDTAppBulk
54 | }
55 | foreach ($InstallFile in (Get-ChildItem -Path $SearchFolder.FullName *.exe)){
56 | $Install = $InstallFile.Name
57 | $InstallFolder = $InstallFile.DirectoryName
58 | $InstallLongAppName = $InstallFolder | Split-Path -Leaf
59 | $InstallerType = $InstallFilet.Extension
60 | $CommandLine = "$Install /q"
61 | Write-Verbose "Installer is $Install"
62 | Write-Verbose "InstallFolder is $InstallFolder"
63 | Write-Verbose "InstallLongAppName is $InstallLongAppName"
64 | Write-Verbose "InstallCommand is $CommandLine"
65 | Write-Verbose ""
66 | . Import-MDTAppBulk
67 | }
68 | foreach ($InstallFile in (Get-ChildItem -Path $SearchFolder.FullName *.msi)){
69 | $Install = $InstallFile.Name
70 | $InstallFolder = $InstallFile.DirectoryName
71 | $InstallLongAppName = $InstallFolder | Split-Path -Leaf
72 | $InstallerType = $InstallFilet.Extension
73 | $CommandLine = "msiexec.exe /i $Install /qn"
74 | Write-Verbose "Installer is $Install"
75 | Write-Verbose "InstallFolder is $InstallFolder"
76 | Write-Verbose "InstallLongAppName is $InstallLongAppName"
77 | Write-Verbose "InstallCommand is $CommandLine"
78 | Write-Verbose ""
79 | . Import-MDTAppBulk
80 | }
81 | foreach ($InstallFile in (Get-ChildItem -Path $SearchFolder.FullName *.msu)){
82 | $Install = $InstallFile.Name
83 | $InstallFolder = $InstallFile.DirectoryName
84 | $InstallLongAppName = $InstallFolder | Split-Path -Leaf
85 | $InstallerType = $InstallFilet.Extension
86 | $CommandLine = "wusa.exe $Install /Quiet /NoRestart"
87 | Write-Verbose "Installer is $Install"
88 | Write-Verbose "InstallFolder is $InstallFolder"
89 | Write-Verbose "InstallLongAppName is $InstallLongAppName"
90 | Write-Verbose "InstallCommand is $CommandLine"
91 | Write-Verbose ""
92 | . Import-MDTAppBulk
93 |
94 | }
95 | foreach ($InstallFile in (Get-ChildItem -Path $SearchFolder.FullName *.ps1)){
96 | $Install = $InstallFile.Name
97 | $InstallFolder = $InstallFile.DirectoryName
98 | $InstallLongAppName = $InstallFolder | Split-Path -Leaf
99 | $InstallerType = $InstallFilet.Extension
100 | $CommandLine = "PowerShell.exe -ExecutionPolicy ByPass -File $Install"
101 | Write-Verbose "Installer is $Install"
102 | Write-Verbose "InstallFolder is $InstallFolder"
103 | Write-Verbose "InstallLongAppName is $InstallLongAppName"
104 | Write-Verbose "InstallCommand is $CommandLine"
105 | Write-Verbose ""
106 | . Import-MDTAppBulk
107 |
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/Tools/Install - C++ Runtime v14 framework package for Desktop Bridge/Install-C++Runtimev14.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 | #Start Transcript Logging
117 | . Start-Logging
118 |
119 | #Detect current OS Version
120 | $OSVersion = Get-OSVersion
121 |
122 | #Output base info
123 | Write-Output ""
124 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
125 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
126 | Write-Output "$ScriptName - ScriptName: $ScriptName"
127 | Write-Output "$ScriptName - OS Name: $OSVersion"
128 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
129 | Write-Output "$ScriptName - Current Culture: $LANG"
130 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
131 | Write-Output "$ScriptName - Log: $LogFile"
132 |
133 | $InstallerFile = Get-ChildItem -Path $SOURCEROOT -Filter *.exe
134 |
135 | $Arguments = "/QUIET /NORESTART "
136 | $Exe = $InstallerFile.FullName
137 |
138 | Write-Output "$ScriptName - Invoke-Exe -Executable $Exe -Arguments $Arguments"
139 | Invoke-Exe -Executable $Exe -Arguments $Arguments
140 | #Stop Logging
141 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install - Dell command update en/Install-Dell_command_update.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 |
117 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
118 | $Logpath = $tsenv.Value("LogPath")
119 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
120 |
121 |
122 | #Start Transcript Logging
123 | . Start-Logging
124 |
125 | #Detect current OS Version
126 | $OSVersion = Get-OSVersion
127 |
128 | #Output base info
129 | Write-Output ""
130 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
131 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
132 | Write-Output "$ScriptName - ScriptName: $ScriptName"
133 | Write-Output "$ScriptName - OS Name: $OSVersion"
134 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
135 | Write-Output "$ScriptName - Current Culture: $LANG"
136 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
137 | Write-Output "$ScriptName - Log: $LogFile"
138 |
139 | $exes = Get-ChildItem -Path $SOURCEROOT -Filter *.exe
140 | foreach($exe in $exes){
141 | $Installer = """$($exe.fullname)"""
142 | $LogFile = """$("$Logpath\$($exe.name)" + ".log")"""
143 | $Arguments = "/s /l=$LogFile"
144 | $result = Invoke-Exe -Executable $Installer -Arguments $Arguments -Verbose
145 |
146 | switch ($result)
147 | {
148 | '2' {Return 3010}
149 | Default {Return 1}
150 | }
151 |
152 | #Stop Logging
153 | . Stop-Logging
154 | Break
155 | }
156 |
157 |
--------------------------------------------------------------------------------
/Tools/Install - Microsoft BGInfo - x86-x64/Install-MicrosoftBGInfox86x64.wsf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
85 |
--------------------------------------------------------------------------------
/Tools/Install - Microsoft BGInfo - x86-x64/Source/Custom.bgi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeploymentBunny/Files/8eb059298667730ab6170c6c111aa9bdf4a5a723/Tools/Install - Microsoft BGInfo - x86-x64/Source/Custom.bgi
--------------------------------------------------------------------------------
/Tools/Install - Mozilla Firefox/Install-MozillaFirefox.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 | #Start Transcript Logging
117 | . Start-Logging
118 |
119 | #Detect current OS Version
120 | $OSVersion = Get-OSVersion
121 |
122 | #Output base info
123 | Write-Output ""
124 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
125 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
126 | Write-Output "$ScriptName - ScriptName: $ScriptName"
127 | Write-Output "$ScriptName - OS Name: $OSVersion"
128 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
129 | Write-Output "$ScriptName - Current Culture: $LANG"
130 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
131 | Write-Output "$ScriptName - Log: $LogFile"
132 |
133 | $InstallerFiles = Get-ChildItem -Path $SOURCEROOT -Filter *.exe -Recurse
134 |
135 | foreach($InstallerFile in $InstallerFiles){
136 | $Exe = """$($InstallerFile.fullname)"""
137 | $Args = "-ms"
138 | Write-Output "Invoke-Exe -Executable $Exe -Arguments $Args"
139 | Invoke-Exe -Executable $Exe -Arguments $Args -Verbose
140 | }
141 |
142 | #Stop Logging
143 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install - Notepad++/Install-NPP.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 | #Start Transcript Logging
117 | . Start-Logging
118 |
119 | #Detect current OS Version
120 | $OSVersion = Get-OSVersion
121 |
122 | #Output base info
123 | Write-Output ""
124 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
125 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
126 | Write-Output "$ScriptName - ScriptName: $ScriptName"
127 | Write-Output "$ScriptName - OS Name: $OSVersion"
128 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
129 | Write-Output "$ScriptName - Current Culture: $LANG"
130 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
131 | Write-Output "$ScriptName - Log: $LogFile"
132 |
133 |
134 | $InstallerFiles = Get-ChildItem -Path $SOURCEROOT -Filter *.exe
135 |
136 | foreach($InstallerFile in $InstallerFiles){
137 | $Args = "/S"
138 | $Exe = $InstallerFile.FullName
139 | Write-Output "Invoke-Exe -Executable $Exe -Arguments $Args"
140 | Invoke-Exe -Executable $Exe -Arguments $Args
141 | }
142 |
143 | #Stop Logging
144 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus Project/Install-Office365Project.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 | #Start Transcript Logging
117 | . Start-Logging
118 |
119 | #Detect current OS Version
120 | $OSVersion = Get-OSVersion
121 |
122 | #Output base info
123 | Write-Output ""
124 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
125 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
126 | Write-Output "$ScriptName - ScriptName: $ScriptName"
127 | Write-Output "$ScriptName - OS Name: $OSVersion"
128 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
129 | Write-Output "$ScriptName - Current Culture: $LANG"
130 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
131 | Write-Output "$ScriptName - Log: $LogFile"
132 |
133 | $DestFolder = "$env:TEMP\o365"
134 | New-Item -Path $DestFolder -Force -ItemType Directory
135 | robocopy """$SOURCEROOT""" """$DestFolder""" /e /s
136 |
137 | $ConfigFile = """$DestFolder\Configuration.xml"""
138 |
139 | $Args = "/configure $ConfigFile"
140 | $Exec = "$DestFolder\setup.exe"
141 |
142 | Invoke-Exe -Executable $Exec -Arguments $Args -Verbose
143 |
144 | Remove-Item -Path $DestFolder -Recurse -Force
145 |
146 | #Stop Logging
147 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus Project/Source/Configuration.old.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus Project/Source/Configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus Project/Source/Download.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus Project/Source/configuration-Office365-x64.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus Project/Source/installOfficeProPlus64.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus Visio/Install-Office365Visio.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 | #Start Transcript Logging
117 | . Start-Logging
118 |
119 | #Detect current OS Version
120 | $OSVersion = Get-OSVersion
121 |
122 | #Output base info
123 | Write-Output ""
124 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
125 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
126 | Write-Output "$ScriptName - ScriptName: $ScriptName"
127 | Write-Output "$ScriptName - OS Name: $OSVersion"
128 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
129 | Write-Output "$ScriptName - Current Culture: $LANG"
130 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
131 | Write-Output "$ScriptName - Log: $LogFile"
132 |
133 | $DestFolder = "$env:TEMP\o365"
134 | New-Item -Path $DestFolder -Force -ItemType Directory
135 | robocopy """$SOURCEROOT""" """$DestFolder""" /e /s
136 |
137 | $ConfigFile = """$DestFolder\Configuration.xml"""
138 |
139 | $Args = "/configure $ConfigFile"
140 | $Exec = "$DestFolder\setup.exe"
141 |
142 | Invoke-Exe -Executable $Exec -Arguments $Args -Verbose
143 |
144 | Remove-Item -Path $DestFolder -Recurse -Force
145 |
146 | #Stop Logging
147 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus Visio/Source/Configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus Visio/Source/Download.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus Visio/Source/configuration-Office365-x64.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus Visio/Source/installOfficeProPlus64.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus/Install-Office365.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 | #Start Transcript Logging
117 | . Start-Logging
118 |
119 | #Detect current OS Version
120 | $OSVersion = Get-OSVersion
121 |
122 | #Output base info
123 | Write-Output ""
124 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
125 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
126 | Write-Output "$ScriptName - ScriptName: $ScriptName"
127 | Write-Output "$ScriptName - OS Name: $OSVersion"
128 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
129 | Write-Output "$ScriptName - Current Culture: $LANG"
130 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
131 | Write-Output "$ScriptName - Log: $LogFile"
132 |
133 | $DestFolder = "$env:TEMP\o365"
134 | New-Item -Path $DestFolder -Force -ItemType Directory
135 | robocopy """$SOURCEROOT""" """$DestFolder""" /e /s
136 |
137 | $ConfigFile = """$DestFolder\Configuration.xml"""
138 |
139 | $Args = "/configure $ConfigFile"
140 | $Exec = "$DestFolder\setup.exe"
141 |
142 | Invoke-Exe -Executable $Exec -Arguments $Args -Verbose
143 |
144 | Remove-Item -Path $DestFolder -Recurse -Force
145 |
146 | #Stop Logging
147 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus/Source/Configuration.old.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus/Source/Configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus/Source/Download.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus/Source/configuration-Office365-x64.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Tools/Install - Office 365 ProPlus/Source/installOfficeProPlus64.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Tools/Install - PDF Creator/Install-PDFCreator.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 | #Start Transcript Logging
117 | . Start-Logging
118 |
119 | #Detect current OS Version
120 | $OSVersion = Get-OSVersion
121 |
122 | #Output base info
123 | Write-Output ""
124 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
125 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
126 | Write-Output "$ScriptName - ScriptName: $ScriptName"
127 | Write-Output "$ScriptName - OS Name: $OSVersion"
128 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
129 | Write-Output "$ScriptName - Current Culture: $LANG"
130 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
131 | Write-Output "$ScriptName - Log: $LogFile"
132 |
133 | $InstallerFiles = Get-ChildItem -Path $SOURCEROOT -Filter *.exe -Verbose
134 |
135 | foreach($InstallerFile in $InstallerFiles){
136 | $Exe = """$($InstallerFile.fullname)"""
137 | $Args = '/COMPONENTS="program" /VERYSILENT /NORESTART'
138 | Write-Output "Invoke-Exe -Executable $Exe -Arguments $Args"
139 | Invoke-Exe -Executable $Exe -Arguments $Args -Verbose
140 | }
141 |
142 |
143 | #Stop Logging
144 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install - Putty/Install-Putty.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 | #Start Transcript Logging
117 | . Start-Logging
118 |
119 | #Detect current OS Version
120 | $OSVersion = Get-OSVersion
121 |
122 | #Output base info
123 | Write-Output ""
124 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
125 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
126 | Write-Output "$ScriptName - ScriptName: $ScriptName"
127 | Write-Output "$ScriptName - OS Name: $OSVersion"
128 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
129 | Write-Output "$ScriptName - Current Culture: $LANG"
130 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
131 | Write-Output "$ScriptName - Log: $LogFile"
132 |
133 | $InstallerFiles = Get-ChildItem -Path $SOURCEROOT -Filter *.msi
134 |
135 | foreach($InstallerFile in $InstallerFiles){
136 | $Exe = "msiexec.exe"
137 | $MSIFile = """$($InstallerFile.fullname)"""
138 | $Args = "/i $MSIFile /qb"
139 | Write-Output "Invoke-Exe -Executable $Exe -Arguments $Args"
140 | Invoke-Exe -Executable $Exe -Arguments $Args
141 | }
142 |
143 | #Stop Logging
144 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install - RSAT/Install-RSAT.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 | #Start Transcript Logging
117 | . Start-Logging
118 |
119 | #Detect current OS Version
120 | $OSVersion = Get-OSVersion
121 |
122 | #Output base info
123 | Write-Output ""
124 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
125 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
126 | Write-Output "$ScriptName - ScriptName: $ScriptName"
127 | Write-Output "$ScriptName - OS Name: $OSVersion"
128 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
129 | Write-Output "$ScriptName - Current Culture: $LANG"
130 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
131 | Write-Output "$ScriptName - Log: $LogFile"
132 |
133 | Write-Output "$ScriptName - Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online -Verbose"
134 | Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online -Verbose
135 |
136 | Write-Output "$ScriptName - Get-WindowsCapability -Name RSAT* -Online | Select-Object -Property DisplayName, State"
137 | Get-WindowsCapability -Name RSAT* -Online | Select-Object -Property DisplayName, State
138 |
139 | #Stop Logging
140 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install - VLCPlayer/Install-VLCPlayer.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 | #Start Transcript Logging
117 | . Start-Logging
118 |
119 | #Detect current OS Version
120 | $OSVersion = Get-OSVersion
121 |
122 | #Output base info
123 | Write-Output ""
124 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
125 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
126 | Write-Output "$ScriptName - ScriptName: $ScriptName"
127 | Write-Output "$ScriptName - OS Name: $OSVersion"
128 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
129 | Write-Output "$ScriptName - Current Culture: $LANG"
130 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
131 | Write-Output "$ScriptName - Log: $LogFile"
132 |
133 | $InstallerFiles = Get-ChildItem -Path $SOURCEROOT -Filter *.exe -Recurse
134 |
135 | foreach($InstallerFile in $InstallerFiles){
136 | $Exe = """$($InstallerFile.FullName)"""
137 | $Args = "/S"
138 | Write-Output "Invoke-Exe -Executable $Exe -Arguments $Args"
139 | Invoke-Exe -Executable $Exe -Arguments $Args -Verbose
140 | }
141 |
142 | #Stop Logging
143 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install - VSCode/Install-VSCode.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 | #Start Transcript Logging
117 | . Start-Logging
118 |
119 | #Detect current OS Version
120 | $OSVersion = Get-OSVersion
121 |
122 | #Output base info
123 | Write-Output ""
124 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
125 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
126 | Write-Output "$ScriptName - ScriptName: $ScriptName"
127 | Write-Output "$ScriptName - OS Name: $OSVersion"
128 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
129 | Write-Output "$ScriptName - Current Culture: $LANG"
130 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
131 | Write-Output "$ScriptName - Log: $LogFile"
132 |
133 | $InstallerFile = Get-ChildItem -Path $SOURCEROOT -Filter *.exe
134 |
135 | $Arguments = "/VERYSILENT /NORESTART /MERGETASKS=!runcode"
136 | $Exe = $InstallerFile.FullName
137 |
138 | Write-Output "$ScriptName - Invoke-Exe -Executable $Exe -Arguments $Arguments"
139 | Invoke-Exe -Executable $Exe -Arguments $Arguments
140 |
141 | #Stop Logging
142 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install - Windows Terminal/Install-WindowsTerminal.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 |
10 | [CmdletBinding(SupportsShouldProcess=$true)]
11 | Param()
12 |
13 | Function Invoke-Exe{
14 | [CmdletBinding(SupportsShouldProcess=$true)]
15 |
16 | param(
17 | [parameter(mandatory=$true,position=0)]
18 | [ValidateNotNullOrEmpty()]
19 | [string]
20 | $Executable,
21 |
22 | [parameter(mandatory=$false,position=1)]
23 | [string]
24 | $Arguments
25 | )
26 |
27 | if($Arguments -eq "")
28 | {
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
31 | }else{
32 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
33 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
34 | }
35 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
36 | Return $ReturnFromEXE.ExitCode
37 | }
38 | Function Get-OSVersion{
39 | $OS = Get-WmiObject -Class Win32_OperatingSystem
40 | Switch -Regex ($OS.Version)
41 | {
42 | "6.1"
43 | {
44 | If($OS.ProductType -eq 1)
45 | {$OSv = "Windows 7 SP1"}
46 | Else
47 | {$OSv = "Windows Server 2008 R2"}
48 | }
49 | "6.2"
50 | {If($OS.ProductType -eq 1)
51 | {$OSv = "Windows 8"}
52 | Else
53 | {$OSv = "Windows Server 2012"}
54 | }
55 | "6.3"
56 | {If($OS.ProductType -eq 1)
57 | {$OSv = "Windows 8.1"}
58 | Else
59 | {$OSv = "Windows Server 2012 R2"}
60 | }
61 | "10."
62 | {If($OS.ProductType -eq 1)
63 | {$OSv = "Windows 10"}
64 | Else
65 | {$OSv = "Windows Server 2016"}
66 | }
67 | DEFAULT {$OSv = "Unknown"}
68 | }
69 | Return $OSV
70 | }
71 | Function Import-SMSTSENV{
72 | try
73 | {
74 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
75 | Write-Output "$ScriptName - tsenv is $tsenv "
76 | $MDTIntegration = "YES"
77 |
78 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
79 | }
80 | catch
81 | {
82 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
83 | Write-Output "$ScriptName - Running in standalonemode"
84 | $MDTIntegration = "NO"
85 | }
86 | Finally
87 | {
88 | if ($MDTIntegration -eq "YES"){
89 | $Logpath = $tsenv.Value("LogPath")
90 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
91 |
92 | }
93 | Else{
94 | $Logpath = $env:TEMP
95 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
96 | }
97 | }
98 | }
99 | Function Start-Logging{
100 | start-transcript -path $LogFile -Force
101 | }
102 | Function Stop-Logging{
103 | Stop-Transcript
104 | }
105 |
106 | # Set Vars
107 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
108 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
109 | $SOURCEROOT = "$SCRIPTDIR\Source"
110 | $LANG = (Get-Culture).Name
111 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
112 |
113 | #Try to Import SMSTSEnv
114 | . Import-SMSTSENV
115 |
116 | #Start Transcript Logging
117 | . Start-Logging
118 |
119 | #Detect current OS Version
120 | $OSVersion = Get-OSVersion
121 |
122 | #Output base info
123 | Write-Output ""
124 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
125 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
126 | Write-Output "$ScriptName - ScriptName: $ScriptName"
127 | Write-Output "$ScriptName - OS Name: $OSVersion"
128 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
129 | Write-Output "$ScriptName - Current Culture: $LANG"
130 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
131 | Write-Output "$ScriptName - Log: $LogFile"
132 |
133 | $InstallerFiles = Get-ChildItem -Path $SOURCEROOT -Filter *.msixbundle
134 |
135 |
136 | foreach($InstallerFile in $InstallerFiles){
137 | Write-Output "$ScriptName - Add-AppxProvisionedPackage -PackagePath $($InstallerFile.fullname) -Regions All -Online -Verbose -SkipLicense"
138 | Add-AppxProvisionedPackage -PackagePath $($InstallerFile.fullname) -Regions All -Online -Verbose -SkipLicense
139 | }
140 |
141 | #Stop Logging
142 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install-HPBIOSCmdlets/Install-HPBIOSCmdlets-x64.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | Install Wrapper 1.0
3 | Author: Mikael Nystrom
4 | http://www.deploymentbunny.com
5 | #>
6 |
7 | Function Invoke-Exe{
8 | [CmdletBinding(SupportsShouldProcess=$true)]
9 |
10 | param(
11 | [parameter(mandatory=$true,position=0)]
12 | [ValidateNotNullOrEmpty()]
13 | [string]
14 | $Executable,
15 |
16 | [parameter(mandatory=$false,position=1)]
17 | [string]
18 | $Arguments
19 | )
20 |
21 | if($Arguments -eq "")
22 | {
23 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
24 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
25 | }else{
26 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
27 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
28 | }
29 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
30 | Return $ReturnFromEXE.ExitCode
31 | }
32 | Function Get-OSVersion([ref]$OSv){
33 | $OS = Get-WmiObject -class Win32_OperatingSystem
34 | Switch -Regex ($OS.Version)
35 | {
36 | "6.1"
37 | {If($OS.ProductType -eq 1)
38 | {$OSv.value = "Windows 7 SP1"}
39 | Else
40 | {$OSv.value = "Windows Server 2008 R2"}
41 | }
42 | "6.2"
43 | {If($OS.ProductType -eq 1)
44 | {$OSv.value = "Windows 8"}
45 | Else
46 | {$OSv.value = "Windows Server 2012"}
47 | }
48 | "6.3"
49 | {If($OS.ProductType -eq 1)
50 | {$OSv.value = "Windows 8.1"}
51 | Else
52 | {$OSv.value = "Windows Server 2012 R2"}
53 | }
54 | DEFAULT { "Version not listed" }
55 | }
56 | }
57 | Function Import-SMSTSENV{
58 | try
59 | {
60 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
61 | Write-Output "$ScriptName - tsenv is $tsenv "
62 | $MDTIntegration = "YES"
63 |
64 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
65 | }
66 | catch
67 | {
68 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
69 | Write-Output "$ScriptName - Running in standalonemode"
70 | $MDTIntegration = "NO"
71 | }
72 | Finally
73 | {
74 | if ($MDTIntegration -eq "YES"){
75 | $Logpath = $tsenv.Value("LogPath")
76 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
77 |
78 | }
79 | Else{
80 | $Logpath = $env:TEMP
81 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
82 | }
83 | }
84 | }
85 | Function Start-Logging{
86 | start-transcript -path $LogFile -Force
87 | }
88 | Function Stop-Logging{
89 | Stop-Transcript
90 | }
91 |
92 | # Set Vars
93 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
94 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
95 | $SOURCEROOT = "$SCRIPTDIR\Source"
96 | $LANG = (Get-Culture).Name
97 | $OSV = $Null
98 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
99 |
100 | #Try to Import SMSTSEnv
101 | . Import-SMSTSENV
102 |
103 | #Start Transcript Logging
104 | . Start-Logging
105 |
106 | #Detect current OS Version
107 | . Get-OSVersion -osv ([ref]$osv)
108 |
109 | #Output base info
110 | Write-Output ""
111 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
112 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
113 | Write-Output "$ScriptName - ScriptName: $ScriptName"
114 | Write-Output "$ScriptName - OS Name: $osv"
115 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
116 | Write-Output "$ScriptName - Current Culture: $LANG"
117 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
118 | Write-Output "$ScriptName - Log: $LogFile"
119 |
120 | $Executable = "msiexec.exe"
121 | $Arguments = "/i ""$SOURCEROOT\HPBIOSCmdlets-x64.msi"" /qb"
122 |
123 | Write-Output "$ScriptName - Executable: $Executable"
124 | Write-Output "$ScriptName - Arguments: $Arguments"
125 |
126 | Invoke-Exe -Executable $Executable -Arguments $Arguments -Verbose
127 |
128 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Install-HPSUM/Install-HPSUM.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Short description.
4 | .DESCRIPTION
5 | Long description
6 | .EXAMPLE
7 |
8 | #>
9 | [CmdletBinding(SupportsShouldProcess=$true)]
10 | Param()
11 |
12 | Function Invoke-Exe{
13 | [CmdletBinding(SupportsShouldProcess=$true)]
14 |
15 | param(
16 | [parameter(mandatory=$true,position=0)]
17 | [ValidateNotNullOrEmpty()]
18 | [string]
19 | $Executable,
20 |
21 | [parameter(mandatory=$false,position=1)]
22 | [string]
23 | $Arguments
24 | )
25 |
26 | if($Arguments -eq "")
27 | {
28 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
29 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
30 | }else{
31 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
32 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
33 | }
34 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
35 | Return $ReturnFromEXE.ExitCode
36 | }
37 | Function Get-OSVersion{
38 | $OS = Get-WmiObject -Class Win32_OperatingSystem
39 | Switch -Regex ($OS.Version)
40 | {
41 | "6.1"
42 | {
43 | If($OS.ProductType -eq 1)
44 | {$OSv = "Windows 7 SP1"}
45 | Else
46 | {$OSv = "Windows Server 2008 R2"}
47 | }
48 | "6.2"
49 | {If($OS.ProductType -eq 1)
50 | {$OSv = "Windows 8"}
51 | Else
52 | {$OSv = "Windows Server 2012"}
53 | }
54 | "6.3"
55 | {If($OS.ProductType -eq 1)
56 | {$OSv = "Windows 8.1"}
57 | Else
58 | {$OSv = "Windows Server 2012 R2"}
59 | }
60 | "10."
61 | {If($OS.ProductType -eq 1)
62 | {$OSv = "Windows 10"}
63 | Else
64 | {$OSv = "Windows Server 2016"}
65 | }
66 | DEFAULT {$OSv = "Unknown"}
67 | }
68 | Return $OSV
69 | }
70 | Function Import-SMSTSENV{
71 | try
72 | {
73 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
74 | Write-Output "$ScriptName - tsenv is $tsenv "
75 | $MDTIntegration = "YES"
76 |
77 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
78 | }
79 | catch
80 | {
81 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
82 | Write-Output "$ScriptName - Running in standalonemode"
83 | $MDTIntegration = "NO"
84 | }
85 | Finally
86 | {
87 | if ($MDTIntegration -eq "YES"){
88 | $Logpath = $tsenv.Value("LogPath")
89 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
90 |
91 | }
92 | Else{
93 | $Logpath = $env:TEMP
94 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
95 | }
96 | }
97 | }
98 | Function Start-Logging{
99 | start-transcript -path $LogFile -Force
100 | }
101 | Function Stop-Logging{
102 | Stop-Transcript
103 | }
104 |
105 | # Set Vars
106 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
107 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
108 | $SOURCEROOT = "$SCRIPTDIR\Source"
109 | $LANG = (Get-Culture).Name
110 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
111 |
112 | #Try to Import SMSTSEnv
113 | . Import-SMSTSENV
114 |
115 | #Start Transcript Logging
116 | . Start-Logging
117 |
118 | #Detect current OS Version
119 | $OSVersion = Get-OSVersion
120 |
121 | #Output base info
122 | Write-Output ""
123 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
124 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
125 | Write-Output "$ScriptName - ScriptName: $ScriptName"
126 | Write-Output "$ScriptName - OS Name: $OSVersion"
127 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
128 | Write-Output "$ScriptName - Current Culture: $LANG"
129 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
130 | Write-Output "$ScriptName - Log: $LogFile"
131 |
132 | #Add SNMP
133 | Add-WindowsFeature -Name 'SNMP-Service','SNMP-WMI-Provider' -IncludeAllSubFeature -IncludeManagementTools
134 |
135 | #Copy folder
136 | $Destination = "$env:TEMP\HPSP"
137 | Copy-Item -Path "$SOURCEROOT" -Destination $Destination -Force -Recurse -Verbose
138 |
139 | $ISO = Get-ChildItem $Destination -Filter *.iso
140 | $ISOMount = Mount-DiskImage -ImagePath $ISO.FullName -PassThru | Get-Volume
141 | $DriveLetter = "$($ISOMount.DriveLetter):"
142 | $DriveLetter
143 |
144 | #Set vars
145 | $Arguments = "/c $DriveLetter\hp\swpackages\hpsum.bat /s"
146 | $Executable = "cmd.exe"
147 |
148 | #Execute
149 | Invoke-Exe -Executable $Executable -Arguments $Arguments -Verbose
150 |
151 | #Cleanup
152 | Dismount-DiskImage -ImagePath $ISO.FullName
153 | Remove-Item -Path $Destination -Force -Recurse
154 |
155 | #Stop Logging
156 | . Stop-Logging
157 |
--------------------------------------------------------------------------------
/Tools/Install-Wrapper/Invoke-Install.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | Install Wrapper 2.1
3 | Author: Mikael Nystrom
4 | http://www.deploymentbunny.com
5 | #>
6 |
7 | [CmdletBinding(SupportsShouldProcess=$true)]
8 | Param()
9 |
10 | Function Invoke-Exe{
11 | [CmdletBinding(SupportsShouldProcess=$true)]
12 |
13 | param(
14 | [parameter(mandatory=$true,position=0)]
15 | [ValidateNotNullOrEmpty()]
16 | [string]
17 | $Executable,
18 |
19 | [parameter(mandatory=$false,position=1)]
20 | [string]
21 | $Arguments
22 | )
23 |
24 | if($Arguments -eq "")
25 | {
26 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
27 | $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
28 | }else{
29 | Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
30 | $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
31 | }
32 | Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
33 | Return $ReturnFromEXE.ExitCode
34 | }
35 | Function Get-OSVersion{
36 | $OS = Get-WmiObject -Class Win32_OperatingSystem
37 | Switch -Regex ($OS.Version)
38 | {
39 | "6.1"
40 | {
41 | If($OS.ProductType -eq 1)
42 | {$OSv = "Windows 7 SP1"}
43 | Else
44 | {$OSv = "Windows Server 2008 R2"}
45 | }
46 | "6.2"
47 | {If($OS.ProductType -eq 1)
48 | {$OSv = "Windows 8"}
49 | Else
50 | {$OSv = "Windows Server 2012"}
51 | }
52 | "6.3"
53 | {If($OS.ProductType -eq 1)
54 | {$OSv = "Windows 8.1"}
55 | Else
56 | {$OSv = "Windows Server 2012 R2"}
57 | }
58 | "10."
59 | {If($OS.ProductType -eq 1)
60 | {$OSv = "Windows 10"}
61 | Else
62 | {$OSv = "Windows Server 2016"}
63 | }
64 | DEFAULT {$OSv = "Unknown"}
65 | }
66 | Return $OSV
67 | }
68 | Function Import-SMSTSENV{
69 | try
70 | {
71 | $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
72 | Write-Output "$ScriptName - tsenv is $tsenv "
73 | $MDTIntegration = "YES"
74 |
75 | #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
76 | }
77 | catch
78 | {
79 | Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
80 | Write-Output "$ScriptName - Running in standalonemode"
81 | $MDTIntegration = "NO"
82 | }
83 | Finally
84 | {
85 | if ($MDTIntegration -eq "YES"){
86 | $Logpath = $tsenv.Value("LogPath")
87 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
88 |
89 | }
90 | Else{
91 | $Logpath = $env:TEMP
92 | $LogFile = $Logpath + "\" + "$ScriptName.txt"
93 | }
94 | }
95 | }
96 | Function Start-Logging{
97 | start-transcript -path $LogFile -Force
98 | }
99 | Function Stop-Logging{
100 | Stop-Transcript
101 | }
102 |
103 | # Set Vars
104 | $SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
105 | $SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
106 | $SOURCEROOT = "$SCRIPTDIR\Source"
107 | $LANG = (Get-Culture).Name
108 | $ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
109 |
110 | #Try to Import SMSTSEnv
111 | . Import-SMSTSENV
112 |
113 | #Start Transcript Logging
114 | . Start-Logging
115 |
116 | #Detect current OS Version
117 | $OSVersion = Get-OSVersion
118 |
119 | #Output base info
120 | Write-Output ""
121 | Write-Output "$ScriptName - ScriptDir: $ScriptDir"
122 | Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
123 | Write-Output "$ScriptName - ScriptName: $ScriptName"
124 | Write-Output "$ScriptName - OS Name: $OSVersion"
125 | Write-Output "$ScriptName - OS Architecture: $ARCHITECTURE"
126 | Write-Output "$ScriptName - Current Culture: $LANG"
127 | Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
128 | Write-Output "$ScriptName - Log: $LogFile"
129 |
130 | $InstallerFile = Get-ChildItem -Path $SOURCEROOT -Filter *.exe
131 |
132 | $Arguments = "/VERYSILENT /NORESTART /MERGETASKS=!runcode"
133 | $Exe = $InstallerFile.FullName
134 |
135 | Write-Output "$ScriptName - Invoke-Exe -Executable $Exe -Arguments $Arguments"
136 | Invoke-Exe -Executable $Exe -Arguments $Arguments
137 |
138 | #Stop Logging
139 | . Stop-Logging
--------------------------------------------------------------------------------
/Tools/Invoke-WSUSMaint/Invoke-WSUSMaint.ps1:
--------------------------------------------------------------------------------
1 | #Get and Set the WSUS Server target
2 | $WSUSSrv = Get-WsusServer -Name $env:COMPUTERNAME -PortNumber 8530
3 | Write-Output "Working on $($WSUSSrv.name)"
4 |
5 | if (($WSUSSrv.GetDatabaseConfiguration()).IsUsingWindowsInternalDatabase -eq $false){
6 | $WSUSDBComputerName = $WSUSSrv.GetDatabaseConfiguration().ServerName | Split-Path
7 | $WSUSDBInstanceName = $WSUSSrv.GetDatabaseConfiguration().ServerName | Split-Path -Leaf
8 | $WSUSDBDBName = $WSUSSrv.GetDatabaseConfiguration().DatabaseName
9 | Write-Host "Database Server name: $WSUSDBComputerName"
10 | Write-Host "Database Server Instance name: $WSUSDBInstanceName"
11 | Write-Host "Database name: $WSUSDBDBName"
12 | $WSUSDB = '\\.\pipe\MSSQL$SQLEXPRESS\sql\query'
13 | }else{
14 | $WSUSDB = "\\.\pipe\MICROSOFT##WID\tsql\query"
15 | }
16 |
17 | #Setup
18 | $RunningFromFolder = "E:\Invoke-WSUSMaint"
19 | #$RunningFromFolder = $MyInvocation.MyCommand.Path | Split-Path -Parent
20 | $WsusDBMaintenanceFile = "$RunningFromFolder\WsusDBMaintenance.sql"
21 | $WsusDBRemoveObsolete = "$RunningFromFolder\RemoveObsoleteUpdates.sql"
22 |
23 | if(!(Test-Path $WSUSDB) -eq $true){Write-Warning "Could not access the WID database";BREAK}
24 | if(!(Test-Path $WsusDBMaintenanceFile) -eq $true){Write-Warning "Could not access the WsusDBMaintenance.sql, make sure you have downloaded the file from https://gallery.technet.microsoft.com/scriptcenter/6f8cde49-5c52-4abd-9820-f1d270ddea61#content";BREAK}
25 |
26 | Write-Output "Running from: $RunningFromFolder"
27 | Write-Output "Using SQL FIle: $WsusDBMaintenanceFile"
28 | Write-Output "Using DB: $WSUSDB"
29 |
30 | #Cleanup the SUDB
31 | Write-Output "Remove Obsolete directly from DB"
32 | $Command = "sqlcmd.exe"
33 | $Arguments = "-E -S $WSUSDB /i $WsusDBRemoveObsolete"
34 | $ReturnFromEXE = Start-Process -FilePath $Command -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
35 |
36 | #Cleanup the SUDB
37 | Write-Output "Defrag and Cleanup DB using the supported MSFT script"
38 | $Command = "sqlcmd.exe"
39 | $Arguments = "-E -S $WSUSDB /i $WsusDBMaintenanceFile"
40 | $ReturnFromEXE = Start-Process -FilePath $Command -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
41 |
42 | #Decline All Itanium
43 | #$SuperSeededUpdates = Get-WsusUpdate -Approval AnyExceptDeclined -Classification All -Status Any | Where-Object -Property Title -Like -Value *Itanium*
44 | #$ReturnfromSuperSeededUpdates = $SuperSeededUpdates | Deny-WsusUpdate -Verbose
45 |
46 | #Decline superseeded updates
47 | Write-Output "Getting all Superseded's"
48 | $SuperSeededUpdates = Get-WsusUpdate -Approval AnyExceptDeclined -Classification All -Status Any | Where-Object -Property UpdatesSupersedingThisUpdate -NE -Value 'None' -Verbose
49 | $ReturnfromSuperSeededUpdates = $SuperSeededUpdates | Deny-WsusUpdate -Verbose
50 |
51 | #Cleanup WSUS
52 | Write-Output "Cleanup Obsolete Computers"
53 | $CleanupObsoleteComputers = Invoke-WsusServerCleanup -UpdateServer $WSUSSrv -CleanupObsoleteComputers
54 |
55 | Write-Output "Cleanup Obsolete Updates"
56 | $CleanupObsoleteUpdates = Invoke-WsusServerCleanup -UpdateServer $WSUSSrv -CleanupObsoleteUpdates
57 |
58 | Write-Output "Cleanup Unneeded Content Files"
59 | $CleanupUnneededContentFiles = Invoke-WsusServerCleanup -UpdateServer $WSUSSrv -CleanupUnneededContentFiles
60 |
61 | Write-Output "Compress Updates"
62 | $CompressUpdates = Invoke-WsusServerCleanup -UpdateServer $WSUSSrv -CompressUpdates
63 |
64 | Write-Output "Decline Expired Updates"
65 | $DeclineExpiredUpdates = Invoke-WsusServerCleanup -UpdateServer $WSUSSrv -DeclineExpiredUpdates
66 |
67 | Write-Output "Decline Superseded Updates"
68 | $DeclineSupersededUpdates = Invoke-WsusServerCleanup -UpdateServer $WSUSSrv -DeclineSupersededUpdates
69 |
70 | #Cleanup the SUDB
71 | Write-Output "Defrag and Cleanup DB"
72 | $Command = "sqlcmd.exe"
73 | $Arguments = "-E -S $WSUSDB /i $WsusDBMaintenanceFile"
74 | $ReturnFromEXE = Start-Process -FilePath $Command -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
75 |
76 | $SuperSeededUpdates
77 | $CleanupObsoleteComputers
78 | $CleanupObsoleteUpdates
79 | $CleanupUnneededContentFiles
80 | $CompressUpdates
81 | $DeclineExpiredUpdates
82 | $DeclineSupersededUpdates
83 | Write-Output "Done"
--------------------------------------------------------------------------------
/Tools/Invoke-WSUSMaint/RemoveObsoleteUpdates.sql:
--------------------------------------------------------------------------------
1 | USE SUSDB
2 | DECLARE @var1 INT
3 | DECLARE @msg nvarchar(100)
4 | CREATE TABLE #results (Col1 INT)
5 | INSERT INTO #results(Col1) EXEC spGetObsoleteUpdatesToCleanup
6 | DECLARE WC Cursor
7 | FOR
8 | SELECT Col1 FROM #results
9 | OPEN WC
10 | FETCH NEXT FROM WC
11 | INTO @var1
12 | WHILE (@@FETCH_STATUS > -1)
13 | BEGIN SET @msg = 'Deleting ' + CONVERT(varchar(10), @var1)
14 | RAISERROR(@msg,0,1) WITH NOWAIT EXEC spDeleteUpdate @localUpdateID=@var1
15 | FETCH NEXT FROM WC INTO @var1 END
16 | CLOSE WC
17 | DEALLOCATE WC
18 | DROP TABLE #results
--------------------------------------------------------------------------------
/Tools/Invoke-WSUSMaint/WsusDBMaintenance.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeploymentBunny/Files/8eb059298667730ab6170c6c111aa9bdf4a5a723/Tools/Invoke-WSUSMaint/WsusDBMaintenance.sql
--------------------------------------------------------------------------------
/Tools/MDTComputerInventoryStoredProcedure/HardwareInfo.vbs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeploymentBunny/Files/8eb059298667730ab6170c6c111aa9bdf4a5a723/Tools/MDTComputerInventoryStoredProcedure/HardwareInfo.vbs
--------------------------------------------------------------------------------
/Tools/MDTComputerInventoryStoredProcedure/IventoryComputer.sql:
--------------------------------------------------------------------------------
1 | USE [Change this to name of the MDT Database]
2 | GO
3 | /****** Object: StoredProcedure [dbo].[InventoryComputer] Script Date: 2/22/2018 1:13:36 PM ******/
4 | SET ANSI_NULLS ON
5 | GO
6 | SET QUOTED_IDENTIFIER ON
7 | GO
8 |
9 | ALTER PROCEDURE [dbo].[InventoryComputer]
10 | @UUID as nvarchar(50),
11 | @AssetTag as nvarchar(255),
12 | @SerialNumber as nvarchar(255),
13 | @MacAddress as nvarchar(50),
14 | @OSDComputerName as nvarchar(255),
15 | @MakeAlias nvarchar(255),
16 | @ModelAlias nvarchar(255),
17 | @MemoryInGB as nvarchar(255),
18 | @NumberOfProcessors as nvarchar(255),
19 | @CPUName as nvarchar(255),
20 | @DiskDriveCaptation as nvarchar(255),
21 | @DiskDriveSize as nvarchar(255),
22 | @NetAdapterName as nvarchar(255),
23 | @GPUAdapterName as nvarchar(255)
24 |
25 | AS
26 | BEGIN
27 | SET NOCOUNT ON;
28 |
29 | DECLARE @COMPUTERID AS INT
30 | IF EXISTS (SELECT 1 FROM dbo.ComputerIdentity WHERE (SerialNumber = @SerialNumber AND @SerialNumber <> '') OR (AssetTag = @AssetTag AND @AssetTag <> '') OR (MacAddress = @MacAddress AND @MacAddress <> '') OR (UUID = @UUID AND @UUID <> ''))
31 | BEGIN
32 | BEGIN TRAN
33 | SET @COMPUTERID = (SELECT ID From dbo.ComputerIdentity Where (SerialNumber = @SerialNumber AND @SerialNumber <> '') OR (AssetTag = @AssetTag AND @AssetTag <> '') OR (MacAddress = @MacAddress AND @MacAddress <> '') OR (UUID = @UUID AND @UUID <> ''))
34 | UPDATE dbo.ComputerIdentity
35 | SET SerialNumber = @SerialNumber,
36 | AssetTag = @AssetTag,
37 | MacAddress = @MacAddress,
38 | UUID = @UUID,
39 | [Description] = @OSDComputerName
40 | WHERE ID = @COMPUTERID
41 |
42 | UPDATE dbo.Settings
43 | SET OSDComputerName = @OSDComputerName,
44 | InvMakeAlias = @MakeAlias,
45 | InvModelAlias = @ModelAlias,
46 | InvMemory = @MemoryInGB,
47 | InvNumberOfProcessors = @NumberOfProcessors,
48 | InvCPUName = @CPUName,
49 | InvDiskDriveCaptation = @DiskDriveCaptation,
50 | InvDiskDriveSize = @DiskDriveSize,
51 | InvNetAdapterName = @NetAdapterName,
52 | InvGPUAdapterName = @GPUAdapterName
53 |
54 | WHERE [Type] = 'C' AND ID = @COMPUTERID
55 | COMMIT TRAN
56 | END
57 |
58 | ELSE
59 |
60 | BEGIN
61 | BEGIN TRAN
62 | INSERT INTO dbo.ComputerIdentity
63 | (SerialNumber,MacAddress,UUID,[Description])
64 | VALUES
65 | (@SerialNumber,@MacAddress,@UUID,@OSDComputerName)
66 |
67 | SET @COMPUTERID = SCOPE_IDENTITY()
68 | INSERT INTO dbo.Settings
69 | (ID,[Type],OSDComputerName,InvMakeAlias,InvModelAlias,InvMemory,InvNumberOfProcessors,InvCPUName,InvDiskDriveCaptation,InvDiskDriveSize,InvNetAdapterName,InvGPUAdapterName)
70 | VALUES
71 | (@COMPUTERID,'C',@OSDComputerName,@MakeAlias,@ModelAlias,@MemoryInGB,@NumberOfProcessors,@CPUName,@DiskDriveCaptation,@DiskDriveSize,@NetAdapterName,@GPUAdapterName)
72 |
73 | COMMIT TRAN
74 | END
75 |
76 | END
77 |
78 | SELECT 1 FROM dbo.ComputerIdentity WHERE (SerialNumber = @SerialNumber AND @SerialNumber <> '') OR (MacAddress = @MacAddress AND @MacAddress <> '')
79 |
--------------------------------------------------------------------------------
/Tools/MDTComputerInventoryStoredProcedure/dbupdate.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | Priority=HardwareInfo,UpdateDB
3 | Properties=MakeAlias,ModelAlias,NumberOfProcessors,CPUName,DiskDriveCaptation,DiskDriveSize,NetAdapterName,MemoryInGB,GPUAdapterName
4 |
5 | [HardwareInfo]
6 | UserExit=HardwareInfo.vbs
7 | NumberOfProcessors=#SetComputerSystemNumberOfProcessors()#
8 | SMBIOSVersion=#SetBIOSSMBIOSVersion()#
9 | CPUName=#SetCPUName()#
10 | DiskDriveCaptation=#SetFirstDiskDriveCaptation()#
11 | DiskDriveSize=#SetFirstDiskDriveSize()#
12 | NetAdapterName=#SetFirstNetAdapterName()#
13 | MemoryInGB=#FormatNumber((%Memory%/1024),2)#
14 | GPUAdapterName=#SetGPUAdapterName()#
15 |
16 | [UpdateDB]
17 | SQLServer=
18 | Instance=
19 | Database=
20 | Netlib=DBNMPNTW
21 | SQLShare=
22 | StoredProcedure=InventoryComputer
23 | Parameters=UUID,AssetTag,SerialNumber,MacAddress,OSDComputername,MakeAlias,ModelAlias,MemoryInGB,NumberOfProcessors,CPUName,DiskDriveCaptation,DiskDriveSize,NetAdapterName,GPUAdapterName
24 |
25 |
--------------------------------------------------------------------------------
/Tools/MassUpgradeWindows10/Invoke-ComputerCleanup.ps1:
--------------------------------------------------------------------------------
1 | #Cleanup if something did not work
2 |
3 | #Clen the screen
4 | Clear-Host
5 |
6 | #Import data from CSV
7 | "Import data from CSV"
8 | $Computers = Import-Csv -Path D:\Upgrade2W10\computers.txt
9 | "Working on the following computers"
10 | $Computers.Name
11 | ""
12 |
13 | #Remove folders, files and tasks
14 | "Remove folders, files and tasks"
15 | $TaskName = "Download_Source_Files"
16 | $ScriptBlock = {
17 | & SCHTASKS /Delete /TN \$Using:TaskName /F
18 | Get-Process -Name robocopy | Stop-Process -Force
19 | Get-Process -Name PSEXECV | Stop-Process -Force
20 | Remove-Item -Path c:\Source -Force -Recurse
21 | }
22 | $Cleanup = foreach($Computer in $Computers){
23 | Invoke-Command -ComputerName $Computer.Name -ScriptBlock $ScriptBlock -AsJob
24 | }
25 | do{
26 | Write-Host "Waiting to complete the jobs..."
27 | Start-Sleep -Seconds 5
28 | $Cleanup.ChildJobs
29 | }until($($Cleanup.State) -eq "Completed")
30 | foreach($Job in $Cleanup.ChildJobs){
31 | Write-Host "Result on: $($Job.Location)"
32 | Receive-Job -Job $Job -Keep
33 | }
34 |
--------------------------------------------------------------------------------
/Tools/MassUpgradeWindows10/Invoke-ComputerCompatScan.ps1:
--------------------------------------------------------------------------------
1 | #Clen the screen
2 | Clear-Host
3 |
4 | #Import data from CSV
5 | "Import data from CSV"
6 | $Computers = Import-Csv -Path D:\Upgrade2W10\computers.txt
7 | "Working on the following computers"
8 | $Computers.Name
9 | ""
10 |
11 | #Create batchfile for Compat Scan on each computer
12 | "Create batchfile for Compat Scan on each computer"
13 | $ScriptBlock = {
14 | $CommandFile = "c:\Source\Check.cmd"
15 | Set-Content -Path $CommandFile -Value "@echo off" -Force
16 | Add-Content -Path $CommandFile -Value "c:\source\setup.exe /Auto Upgrade /Quiet /NoReboot /DynamicUpdate Enable /Compat Scanonly" -Force
17 | Add-Content -Path $CommandFile -Value "echo %ERRORLEVEL% > C:\Source\check.txt" -Force
18 | Get-Content -Path $CommandFile
19 | }
20 | $PrepCompatScan = foreach($Computer in $Computers){
21 | Invoke-Command -ComputerName $Computer.Name -ScriptBlock $ScriptBlock -AsJob
22 | }
23 | do{
24 | Write-Host "Waiting to complete the jobs..."
25 | Start-Sleep -Seconds 5
26 | $PrepCompatScan.ChildJobs
27 | }until($($PrepCompatScan.State) -eq "Completed")
28 | foreach($Job in $PrepCompatScan.ChildJobs){
29 | Write-Host "Result on: $($Job.Location)"
30 | Receive-Job -Job $Job -Keep
31 | }
32 |
33 | #Run batchfile for Compat Scan
34 | "Run batchfile for Compat Scan"
35 | $ScriptBlock = {
36 | cmd.exe /c "c:\source\check.cmd"
37 | }
38 | $CompatScan = foreach($Computer in $Computers){
39 | Invoke-Command -ComputerName $Computer.Name -ScriptBlock $ScriptBlock -AsJob
40 | }
41 | do{
42 | Write-Host "Waiting to complete the jobs..."
43 | Start-Sleep -Seconds 20
44 | $CompatScan.ChildJobs
45 | }until($($CompatScan.State) -eq "Completed")
46 | foreach($Job in $CompatScan.ChildJobs){
47 | Write-Host "Result on: $($Job.Location)"
48 | Receive-Job -Job $Job -Keep
49 | }
50 |
51 | #Grab the data from each computer and see if we can upgrade
52 | "Grab the data from each computer and see if we can upgrade"
53 | $ScriptBlock = {
54 | $result = Get-Content "c:\source\check.txt"
55 | switch ($result){
56 | "-1047526896 "{Write-Host "$env:COMPUTERNAME : No issues found." -ForegroundColor Green}
57 | "-1047526904 "{Write-Host "$env:COMPUTERNAME : Compatibility issues found (hard block)." -ForegroundColor Red}
58 | "-1047526908 "{Write-Host "$env:COMPUTERNAME : Migration choice (auto upgrade) not available (probably the wrong SKU or architecture)·" -ForegroundColor Yellow}
59 | "-1047526912 "{Write-Host "$env:COMPUTERNAME : Does not meet system requirements for Windows 10." -ForegroundColor Red}
60 | "-1047526898 "{Write-Host "$env:COMPUTERNAME : Insufficient free disk space." -ForegroundColor Red}
61 | Default{}
62 | }
63 | }
64 | $CompatResult = foreach($Computer in $Computers){
65 | Invoke-Command -ComputerName $Computer.Name -ScriptBlock $ScriptBlock -AsJob
66 | }
67 | do{
68 | Write-Host "Waiting to complete the jobs..."
69 | Start-Sleep -Seconds 5
70 | $CompatResult.ChildJobs
71 | }until($($CompatResult.State) -eq "Completed")
72 | foreach($Job in $CompatResult.ChildJobs){
73 | Write-Host "Result on: $($Job.Location)"
74 | Receive-Job -Job $Job -Keep
75 | }
76 |
--------------------------------------------------------------------------------
/Tools/MassUpgradeWindows10/Invoke-ComputerPrep.ps1:
--------------------------------------------------------------------------------
1 | #Clen the screen
2 | Clear-Host
3 |
4 | #Import data from CSV
5 | "Import data from CSV"
6 | $Computers = Import-Csv -Path D:\Upgrade2W10\computers.txt
7 | "Working on the following computers"
8 | $Computers.Name
9 |
10 | #Connecting to WMI and enable WinRM and PowerShell remote
11 | $PrepJob = foreach($Computer in $Computers){
12 | Invoke-WmiMethod -ComputerName $Computer.Name -Namespace root\cimv2 -Class Win32_Process -Name Create -ArgumentList "winrm quickconfig -quiet" -AsJob
13 | Invoke-WmiMethod -ComputerName $Computer.Name -Namespace root\cimv2 -Class Win32_Process -Name Create -ArgumentList "PowerShell -ExecutionPolicy Bypass -Command Enable-PSRemoting -Force -SkipNetworkProfileCheck" -AsJob
14 | }
15 | do{"Waiting to complete";Start-Sleep -Seconds 10}until($($PrepJob.State) -eq "Completed")
16 | foreach($Job in $PrepJob.ChildJobs){
17 | Write-Host "Result on: $($Job.Location)"
18 | Receive-Job -Job $Job -Keep
19 | }
20 |
--------------------------------------------------------------------------------
/Tools/MassUpgradeWindows10/Invoke-ComputerUpgrade.ps1:
--------------------------------------------------------------------------------
1 | #Install Windows 10
2 |
3 | #Clen the screen
4 | Clear-Host
5 |
6 | #Import data from CSV
7 | "Import data from CSV"
8 | $Computers = Import-Csv -Path D:\Upgrade2W10\computers.txt
9 | "Working on the following computers"
10 | $Computers.Name
11 | ""
12 | #Create batchfile for upgrade on each computer
13 | "Create batchfile for upgrade on each computer"
14 | $ScriptBlock = {
15 | $CommandFile = "c:\Source\Upgrade.cmd"
16 | Set-Content -Path $CommandFile -Value "@echo off" -Force
17 | Add-Content -Path $CommandFile -Value "c:\source\setup.exe /Auto Upgrade /Quiet /NoReboot /DynamicUpdate Disable" -Force
18 | Add-Content -Path $CommandFile -Value "echo %ERRORLEVEL% > C:\Source\upgrade.txt" -Force
19 | Get-Content -Path $CommandFile
20 | }
21 | $PrepInstall = foreach($Computer in $Computers){
22 | Invoke-Command -ComputerName $Computer.Name -ScriptBlock $ScriptBlock -AsJob
23 | }
24 | do{
25 | Write-Host "Waiting to complete the jobs..."
26 | Start-Sleep -Seconds 5
27 | $PrepInstall.ChildJobs
28 | }until($($PrepInstall.State) -eq "Completed")
29 | foreach($Job in $PrepInstall.ChildJobs){
30 | Write-Host "Result on: $($Job.Location)"
31 | Receive-Job -Job $Job -Keep
32 | }
33 |
34 | foreach($Computer in $Computers){
35 | Start-Process -Wait `
36 | -PSPath "C:\PSTools\PsExec.exe" `
37 | -ArgumentList "\\$($Computer.Name) c:\Source\Upgrade.cmd -h -d" `
38 | -RedirectStandardError c:\temp\error.log `
39 | -RedirectStandardOutput c:\temp\output.log
40 | Get-Content -Path c:\temp\error.log
41 | }
42 |
43 |
44 |
45 |
46 |
47 |
48 | BREAK
49 |
50 | $result = Invoke-Command -ComputerName $ComputerName -ScriptBlock {
51 | Get-Content "c:\source\Upgrade.txt"
52 | }
53 |
54 | switch ($result)
55 | {
56 | "0 "{
57 | Write-Host "No issues found."
58 | winrs.exe -r:$ComputerName "shutdown -r -t 0"
59 | }
60 | Default{
61 | Write-Host "Check logfile for errors..."
62 | }
63 | }
--------------------------------------------------------------------------------
/Tools/MassUpgradeWindows10/Invoke-ImageDownload.ps1:
--------------------------------------------------------------------------------
1 | #Download the image using a scheduled task and wait until it is done
2 |
3 | #Import data from CSV
4 | $Computers = Import-Csv -Path D:\Upgrade2W10\computers.txt
5 | "Working on the following computers"
6 | $Computers.Name
7 |
8 | #Setting up credentials and paths for the image to download
9 | $RunAsAccountDomain = "DOMAIN"
10 | $RunAsAccount = "Admin"
11 | $RunAsAccountPassword = "P@ssw0rd"
12 | $SourceFolder = "\\Server\Share"
13 | $TaskName = "Download_Source_Files"
14 | $ScriptBlock = {
15 | $Command = """robocopy.exe $Using:SourceFolder c:\source /e"""
16 | "Running $Command as a scheduled task"
17 | #& SCHTASKS /Delete /TN $Using:TaskName /F
18 | & SCHTASKS /Create /RU $Using:RunAsAccountDomain\$Using:RunAsAccount /RP $Using:RunAsAccountPassword /SC WEEKLY /TN $Using:TaskName /TR $Command /RL HIGHEST /F
19 | }
20 | $PrepJob = foreach($Computer in $Computers){
21 | Invoke-Command -ComputerName $Computer.Name -ScriptBlock $ScriptBlock -AsJob
22 | }
23 | do{Write-Host "Waiting to complete the jobs...";Start-Sleep -Seconds 10}until($($PrepJob.State) -eq "Completed")
24 | foreach($Job in $PrepJob.ChildJobs){
25 | Write-Host "Result on: $($Job.Location)"
26 | Receive-Job -Job $Job -Keep
27 | }
28 |
29 | #Check if the job is ready to run, in that case fire it up
30 | foreach($Computer in $Computers){
31 | $ScriptBlock = {
32 | do{
33 | "$env:COMPUTERNAME"
34 | $result = schtasks.exe /query /fo csv | ConvertFrom-Csv
35 | ($result | Where-Object TaskName -EQ "\$Using:TaskName").Status
36 | }
37 | while(($result | Where-Object TaskName -EQ "\$Using:TaskName").Status -ne "Ready")
38 | & SCHTASKS /Run /TN \$Using:TaskName
39 | }
40 | Invoke-Command -ComputerName $Computer.Name -ScriptBlock $ScriptBlock
41 | }
42 |
43 | #Wait until it is done
44 | foreach($Computer in $Computers){
45 | $ScriptBlock = {
46 | do{
47 | "$env:COMPUTERNAME"
48 | $result = schtasks.exe /query /fo csv | ConvertFrom-Csv
49 | ($result | Where-Object TaskName -EQ "\$Using:TaskName").Status
50 | Start-Sleep -Seconds 10
51 | }
52 | while(($result | Where-Object TaskName -EQ "\$Using:TaskName").Status -ne "Ready")
53 | & SCHTASKS /Delete /TN \$Using:TaskName /F
54 | }
55 | Invoke-Command -ComputerName $Computer.Name -ScriptBlock $ScriptBlock
56 | }
57 |
--------------------------------------------------------------------------------
/Tools/MassUpgradeWindows10/computers.txt:
--------------------------------------------------------------------------------
1 | Name
2 | win7-001
3 | win7-002
4 | win7-003
--------------------------------------------------------------------------------
/Tools/MonitorMDT/MonitorMDT.ps1:
--------------------------------------------------------------------------------
1 | Function Get-MDTIssues{
2 | $eventLog = Get-EventLog -LogName Application -Source MDT_Monitor -EntryType Warning,Error
3 | $eventLog.Message | ForEach-Object {$Event = $_ -replace "\s\{2}" -split 'for Computer ' -split ': '
4 | New-object psobject -property @{
5 | Computer = $($Event[1])
6 | Notification = $($Event[0])
7 | Message = $($Event[2])
8 | }
9 | }
10 | }
11 |
12 | #Header
13 | #It is possible to use CSS instead, i'm just to lazy
14 | $Head = ""
20 |
21 | #Title
22 | $Title = "Deployment Issues"
23 |
24 | #Converting output to HTML
25 | $Output = Get-MDTIssues | Select @{n='Link';e={"$($_.Computer)"}},Notification,Message | Sort-Object -Property Link |
26 | ConvertTo-Html `
27 | -Title $Title `
28 | -Head $Head `
29 | -Body (Get-Date -UFormat "%Y-%m-%d - %T ") `
30 | -PreContent "Deployment Status for: $ENV:COMPUTERNAME
Generated by Power of the Shell
" `
31 | -PostContent "For details, contact support@internet.com
" `
32 | -Property Link,Notification,Message
33 |
34 | #Converting HTML Output, since Convertto-html don't like HTML and mess it up
35 | $OutputMod = $Output | `
36 | ForEach {$_ -replace "<a href='","'} | `
38 | ForEach {$_ -replace '</a>',''}
39 | $OutputMod > C:\MDTWeb\MDTIssues.htm
40 |
--------------------------------------------------------------------------------
/Tools/NANORefImageModule/NANORefImageModule.psm1:
--------------------------------------------------------------------------------
1 | Function New-VIARefImageNANO
2 | {
3 | #Create Ref Image for NANO
4 | [CmdletBinding(SupportsShouldProcess=$true)]
5 | Param(
6 | $ISOImageFile = 'C:\Setup\ISO\WS2016_EVAL.iso',
7 | $WimIndex = '2',
8 | $PackagesFolder = "C:\Setup\Packages\WS2016",
9 | $WimFileSource = 'C:\Setup\WIM\NanoServer.wim',
10 | $WimFileDestination = 'C:\Setup\WIM\NanoServerU.wim',
11 | $WIMMountFolder = 'C:\Mount'
12 | )
13 |
14 | #Mount the ISO and get the driveletter
15 | $MountDiskImageResult = Mount-DiskImage -ImagePath $ISOImageFile -PassThru
16 | $ISODrive = ($MountDiskImageResult | Get-Volume).DriveLetter
17 | Write-Verbose "ISO is mounted on $ISODrive"
18 |
19 | #Get the WimFile and dismount ISO
20 | $Wimfile = "$($ISODrive):\NanoServer\NanoServer.wim"
21 | Write-Verbose "WIMFile is $Wimfile"
22 | if((Test-Path -Path $Wimfile) -eq $false){Write-Warning "Could not access $Wimfile, will break";BREAK}
23 |
24 | Copy-Item -Path $Wimfile -Destination $WimFileSource -Force
25 | Set-ItemProperty -Path $WimFileSource -Name IsReadOnly -Value $false
26 | Copy-Item -Path $WimFileSource -Destination $WimFileDestination -Force
27 | #Get-WindowsImage -ImagePath $Wimfile
28 | Dismount-DiskImage -ImagePath $MountDiskImageResult.ImagePath
29 |
30 | #Patch the image
31 | Mount-WindowsImage -ImagePath $WimFileDestination -Path $WIMMountFolder -Index $WimIndex
32 | $Packages = Get-ChildItem -Path $PackagesFolder -Verbose
33 | foreach($Item in $Packages){
34 | Add-WindowsPackage -PackagePath $Item.fullname -Path $WIMMountFolder -Verbose
35 | }
36 | Dismount-WindowsImage -Path $WIMMountFolder -Save
37 | }
38 | Function Add-VIARefImageNANOFeatures
39 | {
40 | #Create Ref Image for NANO
41 | [CmdletBinding(SupportsShouldProcess=$true)]
42 | Param(
43 | $ISOImageFile = 'C:\Setup\ISO\WS2016_EVAL.iso',
44 | $WimFile = 'C:\Setup\WIM\NanoServerU.wim',
45 | $WIMMountFolder = 'C:\Mount',
46 | $NanoPackages = 'C:\Setup\Packages\NANO',
47 | $FeatureSet,
48 | [switch]$VM
49 | )
50 |
51 | #Mount the ISO and get the driveletter
52 | $MountDiskImageResult = Mount-DiskImage -ImagePath $ISOImageFile -PassThru
53 | $ISODrive = ($MountDiskImageResult | Get-Volume).DriveLetter
54 | Write-Verbose "ISO is mounted on $ISODrive"
55 |
56 | #Get the WimFile and dismount ISO
57 | $NanoPackageFolder = "$($ISODrive):\NanoServer\Packages"
58 | if((Test-Path $NanoPackageFolder) -eq $false){Write-Warning "Could not access $NanoPackageFolder, will break";BREAK}
59 | Copy-Item -Path $NanoPackageFolder -Destination $NanoPackages -Force -Recurse
60 | Dismount-DiskImage -ImagePath $MountDiskImageResult.ImagePath
61 |
62 | #Add features
63 | Mount-WindowsImage -ImagePath $WimFile -Path $WIMMountFolder -Index 1
64 | switch ($FeatureSet)
65 | {
66 | 'Compute' {
67 | Add-WindowsPackage -PackagePath $NanoPackages\Packages\Microsoft-NanoServer-Compute-Package.cab -Path $WIMMountFolder -Verbose
68 | Add-WindowsPackage -PackagePath $NanoPackages\Packages\en-us\Microsoft-NanoServer-Compute-Package_en-US.cab -Path $WIMMountFolder -Verbose
69 | Add-WindowsPackage -PackagePath $NanoPackages\Packages\Microsoft-NanoServer-Storage-Package.cab -Path $WIMMountFolder -Verbose
70 | Add-WindowsPackage -PackagePath $NanoPackages\Packages\en-us\Microsoft-NanoServer-Storage-Package_en-US.cab -Path $WIMMountFolder -Verbose
71 | }
72 | 'Storage' {
73 | Add-WindowsPackage -PackagePath $NanoPackages\Packages\Microsoft-NanoServer-Compute-Package.cab -Path $WIMMountFolder -Verbose
74 | Add-WindowsPackage -PackagePath $NanoPackages\Packages\en-us\Microsoft-NanoServer-Compute-Package_en-US.cab -Path $WIMMountFolder -Verbose
75 | Add-WindowsPackage -PackagePath $NanoPackages\Packages\Microsoft-NanoServer-Storage-Package.cab -Path $WIMMountFolder -Verbose
76 | Add-WindowsPackage -PackagePath $NanoPackages\Packages\en-us\Microsoft-NanoServer-Storage-Package_en-US.cab -Path $WIMMountFolder -Verbose
77 | }
78 | Default {}
79 | }
80 |
81 | if($VM -eq $true){
82 | Write-Verbose "Adding support for running on Hyper-V"
83 | Add-WindowsPackage -PackagePath $NanoPackages\Packages\Microsoft-NanoServer-Guest-Package.cab -Path $WIMMountFolder -Verbose
84 | Add-WindowsPackage -PackagePath $NanoPackages\Packages\en-us\Microsoft-NanoServer-Guest-Package_en-US.cab -Path $WIMMountFolder -Verbose
85 | }
86 | Dismount-WindowsImage -Path $WIMMountFolder -Save
87 | }
88 |
--------------------------------------------------------------------------------
/Tools/NANORefImageModule/NewNANORefImage.ps1:
--------------------------------------------------------------------------------
1 | Import-Module C:\Setup\Files\Tools\NANORefImagemodule\NANORefImageModule.psm1 -Verbose -Force
2 | New-VIARefImageNANO -ISOImageFile C:\Setup\ISO\WS2016_EVAL.iso -WimIndex 2 -PackagesFolder C:\Setup\Packages\WS2016 -WimFileSource C:\Setup\WIM\NanoServer.wim -WimFileDestination C:\Setup\WIM\NanoServerU.wim -WIMMountFolder C:\Mount -Verbose
3 | Add-VIARefImageNANOFeatures -ISOImageFile C:\Setup\ISO\WS2016_EVAL.iso -WimFile C:\Setup\WIM\NanoServerU.wim -WIMMountFolder C:\Mount -NanoPackages C:\Setup\Packages\NANO -FeatureSet Compute -VM
4 |
--------------------------------------------------------------------------------
/Tools/New-HyperVM/New-HyperVM.ps1:
--------------------------------------------------------------------------------
1 | Param(
2 | [Parameter(mandatory=$True)]
3 | [ValidateNotNullOrEmpty()]
4 | [String]
5 | $VMName,
6 |
7 | [Parameter(mandatory=$false)]
8 | [ValidateNotNullOrEmpty()]
9 | #[Int]
10 | $VMMem = 1GB,
11 |
12 | [Parameter(mandatory=$false)]
13 | [ValidateNotNullOrEmpty()]
14 | [int]
15 | $VMvCPU = 1,
16 |
17 | [parameter(mandatory=$True)]
18 | [ValidateNotNullOrEmpty()]
19 | [String]
20 | $VMLocation = "C:\VMs",
21 |
22 | [parameter(mandatory=$false)]
23 | [ValidateNotNullOrEmpty()]
24 | [String]
25 | $VHDFile,
26 |
27 | [parameter(mandatory=$True)]
28 | [ValidateSet("Copy","Diff","Empty")]
29 | [String]
30 | $DiskMode = "Copy",
31 |
32 | [parameter(mandatory=$True)]
33 | [ValidateNotNullOrEmpty()]
34 | [String]
35 | $VMSwitchName,
36 |
37 | [parameter(mandatory=$False)]
38 | [ValidateNotNullOrEmpty()]
39 | [Int]
40 | $VlanID,
41 |
42 | [parameter(mandatory=$False)]
43 | [ValidateSet("1","2")]
44 | [Int]
45 | $VMGeneration,
46 |
47 | [parameter(mandatory=$false)]
48 | [ValidateNotNullOrEmpty()]
49 | [String]
50 | $ISO
51 |
52 | )
53 |
54 | #Create VM
55 | $VM = New-VM -Name $VMName -MemoryStartupBytes $VMMem -Path $VMLocation -NoVHD -Generation $VMGeneration
56 | Remove-VMNetworkAdapter -VM $VM
57 |
58 | #Add Networkadapter
59 | if($VMNetWorkType -eq "Legacy" -and $VMGeneration -eq "1")
60 | {
61 | Add-VMNetworkAdapter -VM $VM -SwitchName $VMSwitchName -IsLegacy $true
62 | }
63 | else
64 | {
65 | Add-VMNetworkAdapter -VM $VM -SwitchName $VMSwitchName
66 | }
67 |
68 | #Set vCPU
69 | if($VMvCPU -ne "1")
70 | {
71 | Set-VMProcessor -Count $VMvCPU -VM $VM
72 | }
73 |
74 | #Set VLAN
75 | If($VlanID -ne $NULL){
76 | Set-VMNetworkAdapterVlan -VlanId $VlanID -Access -VM $VM
77 | }
78 |
79 | #Add Virtual Disk
80 | switch ($DiskMode)
81 | {
82 | Copy {
83 | New-Item "$VMLocation\$VMName\Virtual Hard Disks" -ItemType directory -Force
84 | $VHD = $VHDFile | Split-Path -Leaf
85 | Copy-Item $VHDFile -Destination "$VMLocation\$VMName\Virtual Hard Disks\"
86 | Add-VMHardDiskDrive -VM $VM -Path "$VMLocation\$VMName\Virtual Hard Disks\$VHD"
87 | }
88 | Diff {
89 | New-Item "$VMLocation\$VMName\Virtual Hard Disks" -ItemType directory -Force
90 | $VHD = $VHDFile | Split-Path -Leaf
91 | New-VHD -Path "$VMLocation\$VMName\Virtual Hard Disks\$VHD" -ParentPath $VHDFile -Differencing
92 | Add-VMHardDiskDrive -VMName $VMName -Path "$VMLocation\$VMName\Virtual Hard Disks\$VHD"
93 | }
94 | Empty{
95 | $VHD = $VMName + ".vhdx"
96 | New-VHD -Path "$VMLocation\$VMName\Virtual Hard Disks\$VHD" -SizeBytes 100GB -Dynamic
97 | Add-VMHardDiskDrive -VMName $VMName -Path "$VMLocation\$VMName\Virtual Hard Disks\$VHD"
98 | }
99 | Default {Write-Error "Epic Failure";BREAK}
100 | }
101 |
102 | #Add DVD for Gen2
103 | #if($VMGeneration -ne "1"){Add-VMDvdDrive -VMName $VM -Path $NULL -ErrorAction SilentlyContinue}
104 |
105 | #Mount ISO
106 | if($ISO -ne ''){
107 | Set-VMDvdDrive -Path $ISO -VMName $VMName
108 | }
109 |
110 | #Set Correct Bootorder when booting from VHD in Gen 2
111 | if($VMGeneration -ne "1" -and $DiskMode -ne "Empty")
112 | {
113 | Set-VMFirmware -BootOrder (Get-VMHardDiskDrive -VM $VM) -VM $VM
114 | }
115 |
116 | #Set Correct Bootorder when booting from ISO in Gen 2
117 | if($VMGeneration -ne "1" -and $DiskMode -eq "Empty")
118 | {
119 | Set-VMFirmware -BootOrder (Get-VMDvdDrive -VMName $VMName) -VM $VM
120 | }
121 |
122 |
--------------------------------------------------------------------------------
/Tools/OptimizeVHDs/OptimizeVHDs.ps1:
--------------------------------------------------------------------------------
1 | [CmdletBinding()]
2 | Param(
3 | $VMnames
4 | )
5 |
6 | if($VMnames -eq $null){
7 | $VMnames = (Get-VM).Name
8 | }
9 |
10 | foreach($VMname in $VMnames){
11 | #Check if VM is running
12 | Write-Host "Checking $VMname"
13 | if((Get-VM -Name $VMname).State -eq "off" -and (Get-VM -Name $VMname).ParentCheckpointId -eq $null){
14 |
15 | #Find the disks
16 | foreach($VHD in ((Get-VMHardDiskDrive -VMName $VMname).Path)){
17 | Write-Host "Working on $VHD, please wait"
18 | Write-Host "Current size $([math]::truncate($(Get-VHD -Path $VHD).FileSize/ 1GB)) GB"
19 | Mount-VHD -Path $VHD -NoDriveLetter -ReadOnly
20 | Optimize-VHD -Path $VHD -Mode Full
21 | Write-Host "Optimize size $([math]::truncate($(Get-VHD -Path $VHD).FileSize/ 1GB)) GB"
22 | Dismount-VHD -Path $VHD
23 | Write-Host ""
24 | }
25 | }
26 | else{Write-Warning "$VMname is not turned off or has a snapshot, will not be fixed"
27 | Write-Host ""}
28 | }
29 |
--------------------------------------------------------------------------------
/Tools/OptimizeVHDs/OptimizeVIAVHD.ps1:
--------------------------------------------------------------------------------
1 | Param(
2 | $VMnames,
3 | [switch]$Defrag
4 | )
5 |
6 | Function Start-VIADefrag{
7 | Param(
8 | $DriveLetter
9 | )
10 |
11 | }
12 | Function Optimize-VIAVHD{
13 | [CmdletBinding()]
14 | Param(
15 | $VMnames
16 | )
17 |
18 | foreach($VMname in $VMnames){
19 | #Check if VM is running
20 | Write-Verbose "Checking $VMname"
21 | if((Get-VM -Name $VMname).State -eq "off" -and (Get-VM -Name $VMname).ParentCheckpointId -eq $null){
22 |
23 | #Find the disks
24 | foreach($VHD in ((Get-VMHardDiskDrive -VMName $VMname).Path)){
25 | Write-Verbose "Working on $VHD, please wait"
26 | Write-Verbose "Current size $([math]::truncate($(Get-VHD -Path $VHD).FileSize/ 1GB)) GB"
27 | Mount-VHD -Path $VHD -NoDriveLetter -ReadOnly
28 | Optimize-VHD -Path $VHD -Mode Full
29 | Write-Verbose "Optimize size $([math]::truncate($(Get-VHD -Path $VHD).FileSize/ 1GB)) GB"
30 | Dismount-VHD -Path $VHD
31 | Write-Verbose ""
32 | }
33 | }
34 | else{Write-Warning "$VMname is not turned off or has a snapshot, will not be fixed"
35 | Write-Verbose ""}
36 | }
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/Tools/RestPSFiles/Install Choclaty and NSSM.ps1:
--------------------------------------------------------------------------------
1 | # Install Choclaty
2 | Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
3 |
4 | # Install NSSM
5 | choco install nssm
--------------------------------------------------------------------------------
/Tools/RestPSFiles/Install NuGet and PowerShellGet.ps1:
--------------------------------------------------------------------------------
1 | # Install NuGet Provider
2 | Install-PackageProvider -Name NuGet -Force -Verbose
3 |
4 | # Install PowerShellGet
5 | Install-Module -Name PowerShellGet -Force -SkipPublisherCheck -Verbose
6 |
7 | # Update all modules
8 | Update-Module -Force -Verbose
9 |
--------------------------------------------------------------------------------
/Tools/RestPSFiles/Install and Configure RestPS.ps1:
--------------------------------------------------------------------------------
1 | # Get the Module
2 | Find-Module -Name RestPS | Install-Module -Verbose -SkipPublisherCheck -Force
3 |
4 | # Import Module
5 | Import-Module RestPS -Verbose -Force
6 |
7 | # Initual Configuration
8 | Invoke-DeployRestPS -LocalDir 'C:\RestPS' -Verbose
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Tools/RestPSFiles/Make RestPS a Services.ps1:
--------------------------------------------------------------------------------
1 | # Make RestPS a Service
2 | $NSSMPath = (Get-Command "C:\ProgramData\chocolatey\bin\nssm.exe").Source
3 | $PoShPath = (Get-Command powershell).Source
4 |
5 | $NewServiceName = “RestPS”
6 | $PoShScriptPath = "C:\RestPSService\StartRestPS.ps1"
7 | $args = '-ExecutionPolicy Bypass -NoProfile -File "{0}"' -f $PoShScriptPath
8 |
9 | & $NSSMPath install $NewServiceName $PoShPath $args
10 | & $NSSMPath status $NewServiceName
11 |
12 | # Change the name of the Services
13 | & $NSSMPath set $NewServiceName description "RestFul API Services"
14 |
15 | # Check the Services
16 | Get-Service -Name RestPS
17 |
18 | # Start the Services
19 | Get-Service -Name RestPS | Start-Service
--------------------------------------------------------------------------------
/Tools/RestPSFiles/Start RestPS.ps1:
--------------------------------------------------------------------------------
1 | # Start the RestPS
2 | $RestPSparams = @{
3 | RoutesFilePath = 'C:\RestPS\endpoints\RestPSRoutes.json'
4 | Port = '8080'
5 | }
6 | Start-RestPSListener @RestPSparams
--------------------------------------------------------------------------------
/Tools/RestPSFiles/StartRestPS.ps1:
--------------------------------------------------------------------------------
1 | Start-Transcript -Path C:\RestPSService\Start.log
2 | Import-Module RESTPS -Verbose -Force
3 | Start-RestPSListener -Port 8080 -LogLevel ALL -Logfile C:\RestPSService\RestPS.log -Verbose
4 | Stop-Transcript -Path C:\RestPSService\Start.log
--------------------------------------------------------------------------------
/Tools/RestPSFiles/Test RestPS.ps1:
--------------------------------------------------------------------------------
1 | # Verify that RestPS works
2 | $RestMethodParams = @{
3 | Uri = 'http://localhost:8080/process?name=powershell'
4 | Method = 'Get'
5 | UseBasicParsing = $true
6 | }
7 | Invoke-RestMethod @RestMethodParams
8 |
--------------------------------------------------------------------------------
/Tools/Running-ParJobs/Running-ParJobs.ps1:
--------------------------------------------------------------------------------
1 | $Servers = "Server1","Server2"
2 | $AdminPassword = "P@ssw0rd"
3 | $DomainName = "corp.viamonstra.com"
4 | $DomainAdminPassword = "P@ssw0rd"
5 | $domainCred = New-Object -typename System.Management.Automation.PSCredential -argumentlist "$($domainName)\Administrator", (ConvertTo-SecureString $domainAdminPassword -AsPlainText -Force)
6 | $Session = New-PSSession -VMName $Servers -Credential $domainCred
7 | #$Session = New-PSSession -ComputerName $Servers -Credential $domainCred
8 |
9 |
10 | $InstallJob = Invoke-Command -ScriptBlock {
11 | Get-ChildItem -Path c:\
12 | } -Session $Session -AsJob
13 | do{$InstallJob}until($($InstallJob.State) -eq "Completed")
14 |
15 | foreach($Job in $InstallJob.ChildJobs){
16 | Write-Host ""
17 | Write-Host "Result on: $($Job.Location)"
18 | Write-Host ""
19 | Receive-Job -Job $Job -Keep
20 | }
21 |
--------------------------------------------------------------------------------
/Tools/Save-AllRunningVMs/Save-AllRunningVMs.ps1:
--------------------------------------------------------------------------------
1 | #Selfelevating script "borrowed" from Ben Armstrong - https://blogs.msdn.microsoft.com/virtual_pc_guy/2010/09/23/a-self-elevating-powershell-script/
2 | # Get the ID and security principal of the current user account
3 | $myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
4 | $myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
5 |
6 | # Get the security principal for the Administrator role
7 | $adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
8 |
9 | # Check to see if we are currently running "as Administrator"
10 | if ($myWindowsPrincipal.IsInRole($adminRole))
11 | {
12 | # We are running "as Administrator" - so change the title and background color to indicate this
13 | $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)"
14 | $Host.UI.RawUI.BackgroundColor = "DarkBlue"
15 | clear-host
16 | }
17 | else
18 | {
19 | # We are not running "as Administrator" - so relaunch as administrator
20 |
21 | # Create a new process object that starts PowerShell
22 | $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
23 |
24 | # Specify the current script path and name as a parameter
25 | $newProcess.Arguments = $myInvocation.MyCommand.Definition;
26 |
27 | # Indicate that the process should be elevated
28 | $newProcess.Verb = "runas";
29 |
30 | # Start the new process
31 | [System.Diagnostics.Process]::Start($newProcess);
32 |
33 | # Exit from the current, unelevated, process
34 | exit
35 | }
36 |
37 | # Run your code that needs to be elevated here
38 |
39 | #Script to save all VMs that are running
40 | Get-VM | Where-Object -Property State -EQ -Value Running | Save-VM -Verbose
41 |
42 | Write-Host -NoNewLine "Press any key to continue..."
43 | $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Tools/Set-TSxTimesync/Set-TSxTimesync.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Script for Deployment Fundamentals Vol 6
4 | .DESCRIPTION
5 | Script for Deployment Fundamentals Vol 6
6 | .EXAMPLE
7 | Set-TSxTimeSync.ps1 –TimeSource "se.pool.ntp.org"
8 | .NOTES
9 | Created: 2015-12-15
10 | Version: 1.0
11 |
12 | Author - Mikael Nystrom
13 | Twitter: @mikael_nystrom
14 | Blog : http://deploymentbunny.com
15 |
16 | Author - Johan Arwidmark
17 | Twitter: @jarwidmark
18 | Blog : http://deploymentresearch.com
19 |
20 | Disclaimer:
21 | This script is provided "AS IS" with no warranties, confers no rights and
22 | is not supported by the authors or Deployment Artist.
23 | .LINK
24 | http://www.deploymentfundamentals.com
25 | #>
26 |
27 | [cmdletbinding(SupportsShouldProcess=$True)]
28 | Param(
29 | [Parameter(Mandatory=$True,HelpMessage="Timeserver FQDN.")]
30 | [ValidateNotNullOrEmpty()]
31 | [String]$TimeSource
32 | )
33 |
34 | # Check for elevation
35 | If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
36 | [Security.Principal.WindowsBuiltInRole] "Administrator"))
37 | {
38 | Write-Warning "Oupps, you need to run this script from an elevated PowerShell prompt!`nPlease start the PowerShell prompt as an Administrator and re-run the script."
39 | Write-Warning "Aborting script..."
40 | Throw
41 | }
42 |
43 | function Get-IsVirtual {
44 | $WMISystem = Get-WmiObject Win32_ComputerSystem
45 | $IsVirtual = $False
46 | if($WMISystem.Model -like "*Virtual*"){$IsVirtual = $true}
47 | return $IsVirtual
48 | }
49 |
50 | #Set Values
51 | $NTPServer = $TimeSource + ',0x1'
52 |
53 | # Set Registry Values
54 | Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\ -Name Type -Value NTP
55 | Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config\ -Name AnnounceFlags -Value 5
56 | Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer -Name Enabled -Value 1
57 | Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters -Name NtpServer -Value $NTPServer
58 | Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient -Name SpecialPollInterval -Value 900
59 | Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config\ -Name MaxPosPhaseCorrection -Value 3600
60 |
61 | if(Get-IsVirtual = "True"){
62 | Write-Verbose "Running a Virtual Machine"
63 | Write-Verbose "Will disable WMI TimeSync"
64 | Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\VMICTimeProvider -Name Enabled -Value 0
65 | }
66 |
67 | #Restart the NTP Client
68 | Register-WmiEvent -Query `
69 | "select * from __InstanceModificationEvent within 5 where targetinstance isa 'win32_service'" `
70 | -SourceIdentifier stopped
71 | Stop-Service -Name W32Time
72 | Wait-Event -SourceIdentifier stopped
73 | Start-Service -Name W32Time
74 | Unregister-Event -SourceIdentifier stopped
75 | Start-Process w32tm.exe /resync -Wait
76 |
--------------------------------------------------------------------------------
/Tools/Start-VIADeDupJob/Start-VIADeDupJob.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Synopsis
3 | Start-TSxDedup
4 | .DESCRIPTION
5 | Start-TSxDedup will find all dedup drivs and process them
6 | .EXAMPLE
7 | Start-TSxDedup
8 | .NOTES
9 | This script will give you the option to remove virtual machines running on Hyper-V, including all data files, even if they are running
10 | Selfelevating Script "borrowed" from Ben Armstrong - https://blogs.msdn.microsoft.com/virtual_pc_guy/2010/09/23/a-self-elevating-powershell-script/
11 | FileName: Start-TSxDedup.ps1
12 | Author: Mikael Nystrom
13 | Contact: mikael.nystrom@truesec.se
14 | Created: 2017-01-01
15 | Updated: 2018-09-27
16 | Added code to self elevate to admin
17 | web: http://www.deploymentbunny.com
18 | .FUNCTIONALITY
19 | The script will check if you are elevated or not, if not it will elevate you and then find all dedup drivs and process them.
20 | #>
21 |
22 | # Get the ID and security principal of the current user account
23 | $myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
24 | $myWindowsPrincipal=New-Object System.Security.Principal.WindowsPrincipal($myWindowsID)
25 |
26 | # Get the security principal for the Administrator role
27 | $adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
28 |
29 | # Check to see if we are currently running "as Administrator"
30 | if ($myWindowsPrincipal.IsInRole($adminRole)){
31 | # We are running "as Administrator" - so change the title and background color to indicate this
32 | $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Bootstrap)"
33 | $Host.UI.RawUI.BackgroundColor = "DarkBlue"
34 | Clear-Host
35 | }
36 | else{
37 | # We are not running "as Administrator" - so relaunch as administrator
38 |
39 | # Create a new process object that starts PowerShell
40 | $newProcess = New-Object System.Diagnostics.ProcessStartInfo "PowerShell";
41 |
42 | # Specify the current script path and name as a parameter
43 | $newProcess.Arguments = $myInvocation.MyCommand.Definition;
44 |
45 | # Indicate that the process should be elevated
46 | $newProcess.Verb = "runas";
47 |
48 | # Start the new process
49 | [System.Diagnostics.Process]::Start($newProcess);
50 |
51 | # Exit from the current, unelevated, process
52 | exit
53 | }
54 |
55 | Function Wait-TSxDedupJob
56 | {
57 | while ((Get-DedupJob).count -ne 0 )
58 | {
59 | Get-DedupJob
60 | Start-Sleep -Seconds 30
61 | }
62 | }
63 |
64 | foreach($item in Get-DedupVolume){
65 | Wait-TSxDedupJob
66 | $item | Start-DedupJob -Type Optimization -Priority High -Memory 80
67 | Wait-TSxDedupJob
68 | $item | Start-DedupJob -Type GarbageCollection -Priority High -Memory 80 -Full
69 | Wait-TSxDedupJob
70 | $item | Start-DedupJob -Type Scrubbing -Priority High -Memory 80 -Full
71 | Wait-TSxDedupJob
72 | }
73 | Get-DedupStatus
74 |
--------------------------------------------------------------------------------
/Tools/TSxWrite-MDTMonitor/TSxWrite-MDTMonitor.ps1:
--------------------------------------------------------------------------------
1 | Function TSxWrite-MDTMonitor{
2 | Param(
3 | $MDTServerName,
4 | $MDTServerPort,
5 | $MessageID,
6 | $MacAddress001,
7 | $OSDComputerName,
8 | $GUID,
9 | $TotalSteps,
10 | $CurrentStep,
11 | $ExtraInfo
12 | )
13 | switch ($MessageID)
14 | {
15 | '41002' {
16 | $severity = 2
17 | $LogMessage = "Warning for computer $OSDComputerName :" + $ExtraInfo
18 | }
19 | '41003' {
20 | $severity = 3
21 | $LogMessage = "Error for computer $OSDComputerName :" + $ExtraInfo
22 | }
23 | '41014' {
24 | $severity = 3
25 | $LogMessage = "Deployment failed."
26 | }
27 | '41015' {
28 | $severity = 1
29 | $LogMessage = "Deployment completed successfully."
30 | }
31 | '41016' {
32 | $severity = 1
33 | $LogMessage = "Beginning deployment."
34 | }
35 | Default {
36 | }
37 | }
38 | $MDTServer = $MDTServerName + ":" + $MDTServerPort
39 | Invoke-WebRequest "http://$MDTServer/MDTMonitorEvent/PostEvent?uniqueID=&computerName=$OSDComputerName&messageID=$MessageID&severity=$severity&stepName=$stepName¤tStep=$CurrentStep&totalSteps=$totalSteps&id=$GUID,$MacAddress001&message=$LogMessage&dartIP=$dartIP&dartPort=$dartPort&dartTicket=$dartTicket&vmHost=$vmHost&vmName=$vmName"
40 | }
41 |
42 | $MDTServerName = 'SRVMDT01'
43 | $MDTServerPort = '9800'
44 | $MacAddress001 = ((Get-NetAdapter | Where-Object Status -EQ up)[0].MacAddress).Replace("-",":")
45 | $OSDComputerName = "$Env:ComputerName"
46 |
47 | $GUID = (New-Guid).Guid
48 |
49 | # Beginning deployment.
50 | $MessageID = '41016'
51 | $TotalSteps = 2
52 | $CurrentStep= 0
53 | TSxWrite-MDTMonitor -MDTServerName $MDTServerName -MDTServerPort $MDTServerPort -MessageID $MessageID -MacAddress001 $MacAddress001 -OSDComputerName $OSDComputerName -GUID $GUID -TotalSteps $TotalSteps -CurrentStep $CurrentStep
54 |
55 | # Deployment completed successfully.
56 | $MessageID = '41015'
57 | $TotalSteps = 2
58 | $CurrentStep= 2
59 | TSxWrite-MDTMonitor -MDTServerName $MDTServerName -MDTServerPort $MDTServerPort -MessageID $MessageID -MacAddress001 $MacAddress001 -OSDComputerName $OSDComputerName -GUID $GUID -TotalSteps $TotalSteps -CurrentStep $CurrentStep
60 |
61 | # Deployment failed.
62 | $MessageID = '41014'
63 | $TotalSteps = 2
64 | $CurrentStep= 2
65 | TSxWrite-MDTMonitor -MDTServerName $MDTServerName -MDTServerPort $MDTServerPort -MessageID $MessageID -MacAddress001 $MacAddress001 -OSDComputerName $OSDComputerName -GUID $GUID -TotalSteps $TotalSteps -CurrentStep $CurrentStep
66 |
67 | # Generic Warning
68 | $MessageID = '41002'
69 | $TotalSteps = 2
70 | $CurrentStep= 2
71 | $ExtraInfo = "Description of the warning"
72 | TSxWrite-MDTMonitor -MDTServerName $MDTServerName -MDTServerPort $MDTServerPort -MessageID $MessageID -MacAddress001 $MacAddress001 -OSDComputerName $OSDComputerName -GUID $GUID -TotalSteps $TotalSteps -CurrentStep $CurrentStep -ExtraInfo $ExtraInfo
73 |
74 | # Generic Error
75 | $MessageID = '41003'
76 | $TotalSteps = 2
77 | $CurrentStep= 2
78 | $ExtraInfo = "Description of the error"
79 | TSxWrite-MDTMonitor -MDTServerName $MDTServerName -MDTServerPort $MDTServerPort -MessageID $MessageID -MacAddress001 $MacAddress001 -OSDComputerName $OSDComputerName -GUID $GUID -TotalSteps $TotalSteps -CurrentStep $CurrentStep -ExtraInfo $ExtraInfo
80 |
81 |
82 |
--------------------------------------------------------------------------------
/Tools/Test-ModernDriverPackage/Test-ModernDriverPackage.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | # This script will get driver packages using the Modern Driver Managment WebServices on the machine you run it on
3 | # (http://www.scconfigmgr.com/modern-driver-management)
4 | #>
5 |
6 | $Make = (Get-WmiObject -Class Win32_Computersystem).Manufacturer
7 | switch ($Make)
8 | {
9 | 'HP'{
10 | $MakeAlias='Hewlett-Packard'
11 | $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystem).model
12 | $BaseBoard = (Get-CIMInstance -ClassName MS_SystemInformation -NameSpace root\WMI).BaseBoardProduct
13 | }
14 |
15 | 'Hewlett-Packard'{
16 | $MakeAlias=$Make
17 | $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystem).model
18 | $BaseBoard = (Get-CIMInstance -ClassName MS_SystemInformation -NameSpace root\WMI).BaseBoardProduct
19 | }
20 |
21 | 'Dell'{
22 | $MakeAlias=$Make
23 | $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystem).model
24 | $BaseBoard = (Get-CIMInstance -ClassName MS_SystemInformation -NameSpace root\WMI).SystemSku
25 | }
26 |
27 | 'LENOVO'{
28 | $MakeAlias=$Make
29 | $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystemProduct).version
30 | $BaseBoard = ((Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty Model).SubString(0, 4)).Trim()
31 | }
32 |
33 | 'Microsoft Corporation'{
34 | $MakeAlias='Microsoft'
35 | $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystem).model
36 | $BaseBoard = (Get-WmiObject -Class Win32_ComputerSystem).model
37 | }
38 | Default {}
39 | }
40 |
41 | $MakeAlias
42 | $ModelAlias
43 | $BaseBoard
44 |
45 | $SecrectKey = "329b3c28-1b52-4cd7-abe1-81d93d1e1dda"
46 | $URI = "http://cm01.corp.viamonstra.com/ConfigMgrWebService/ConfigMgr.asmx"
47 | $Web = New-WebServiceProxy -Uri $URI
48 | $Web.
49 | $result = $Web.GetCMPackage($SecrectKey,'Driver')
50 | $result | Where-Object PackageDescription -Like *$BaseBoard*
--------------------------------------------------------------------------------