Added Files
This commit is contained in:
@@ -0,0 +1,520 @@
|
||||
#requires -Version 5.0 -Modules BitsTransfer, CimCmdlets -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Install manufacturer/vendor specific software
|
||||
|
||||
.DESCRIPTION
|
||||
Install manufacturer/vendor specific software
|
||||
For now, just HP is supported.
|
||||
|
||||
.NOTES
|
||||
The OEM Info is no longer displayed in newer Builds of Windows 10!
|
||||
Starting with Windows 10 Build 20H2 the Logo and other OEM Info is no longer displayed.
|
||||
Focus will be the installation of Tools to support the vendor specific drivers and tooling
|
||||
|
||||
Request:
|
||||
If you are interessted in Dell or Lenovo support, please open a issue/ticket.
|
||||
We look for pilot/beta users, due to missing hardware the development is a bit hard.
|
||||
|
||||
Changelog:
|
||||
1.0.7: Download the latest HP versions and install it silently
|
||||
1.0.6: Fallback to older HP Support Assistant version (Due to Silent Install Issues)
|
||||
1.0.5: Moved the installer path
|
||||
1.0.4: Rewrite big parts and create a cleanup helper
|
||||
1.0.3: Replace old WMI call with CIM - Fix Write-Output
|
||||
1.0.2: Update HP tooling (Files)
|
||||
1.0.1: Update Lenovo tooling (Files)
|
||||
|
||||
Version 1.0.7
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Manufacturer specific config and software installation'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
$STP = 'Stop'
|
||||
|
||||
# Splat the defaults
|
||||
$paramSimpleDefaults = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
|
||||
# Change this, if needed
|
||||
$Company = 'enabling Technology'
|
||||
|
||||
# Do not change this!
|
||||
$RegistryPath = ('HKLM:\Software\' + $Company + '\BaseImage')
|
||||
|
||||
# Get the Info
|
||||
$Manufacturer = (Get-ItemPropertyValue -Path $RegistryPath -Name HardwareManufacturer @paramSimpleDefaults)
|
||||
|
||||
# Set the Path Info
|
||||
$OemInfoPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation'
|
||||
|
||||
# Read the Info from CIM
|
||||
$ManufacturerModel = ((Get-CimInstance -ClassName Win32_Computersystem @paramSimpleDefaults) | Select-Object -ExpandProperty Model)
|
||||
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force @paramSimpleDefaults)
|
||||
|
||||
|
||||
if (-not $ManufacturerModel)
|
||||
{
|
||||
$ManufacturerModel = 'Unknown'
|
||||
}
|
||||
|
||||
if ($Manufacturer)
|
||||
{
|
||||
switch ($Manufacturer)
|
||||
{
|
||||
'HP'
|
||||
{
|
||||
$ManufacturerTooling = 'HP'
|
||||
}
|
||||
'Hewlett-Packard'
|
||||
{
|
||||
$ManufacturerTooling = 'HP'
|
||||
}
|
||||
'Dell'
|
||||
{
|
||||
$ManufacturerTooling = 'Dell'
|
||||
Write-Warning -Message 'Dell support is in still in development'
|
||||
}
|
||||
'LENOVO'
|
||||
{
|
||||
$ManufacturerTooling = 'LENOVO'
|
||||
Write-Warning -Message 'Lenovo support is in still in development'
|
||||
}
|
||||
'Microsoft Corporation'
|
||||
{
|
||||
$ManufacturerTooling = 'HYPERV'
|
||||
Write-Warning -Message 'Microsoft Hyper-V is not (yet) supported, but planned'
|
||||
Return
|
||||
}
|
||||
'VMware, Inc.'
|
||||
{
|
||||
$ManufacturerTooling = 'VMware'
|
||||
Write-Warning -Message 'VMware is not (yet) supported'
|
||||
Return
|
||||
}
|
||||
'Parallels Software International Inc.'
|
||||
{
|
||||
$ManufacturerTooling = 'Parallels'
|
||||
Write-Warning -Message 'Parallels is not (yet) supported'
|
||||
Return
|
||||
}
|
||||
Default
|
||||
{
|
||||
$ManufacturerTooling = $null
|
||||
Write-Warning -Message 'Unknown and/or unsupported manufacturer'
|
||||
Return
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ManufacturerTooling = $null
|
||||
Write-Warning -Message 'Unknown and/or unsupported manufacturer'
|
||||
Return
|
||||
}
|
||||
|
||||
# Splat the defaults for New-ItemProperty
|
||||
$paramNewItemProperty = @{
|
||||
Path = $OemInfoPath
|
||||
PropertyType = 'String'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WhatIf = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
|
||||
# Splat the defaults for Copy-Item
|
||||
$paramCopyItem = @{
|
||||
Destination = "$env:windir\SYSTEM32\SYSTEM.BMP"
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
#endregion Defaults
|
||||
|
||||
#region RemoveOEMInfo
|
||||
function Remove-OEMInfo
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Cleanup the OEM Info
|
||||
|
||||
.DESCRIPTION
|
||||
Cleanup the OEM Info from the registry
|
||||
|
||||
.PARAMETER Path
|
||||
The Registry Path
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Remove-OEMInfo
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Remove-OEMInfo -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation'
|
||||
|
||||
.NOTES
|
||||
Internal Helper
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'None',
|
||||
SupportsShouldProcess)]
|
||||
param
|
||||
(
|
||||
[Parameter(ValueFromPipeline,
|
||||
ValueFromPipelineByPropertyName,
|
||||
Position = 0)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias('OemInfoPath')]
|
||||
[string]
|
||||
$Path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation'
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
#region
|
||||
$ValuesToClean = @(
|
||||
'Model'
|
||||
'Manufacturer'
|
||||
'Logo'
|
||||
'SupportAppURL'
|
||||
'SupportURL'
|
||||
'SupportHours'
|
||||
'SupportPhone'
|
||||
)
|
||||
#endregion
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
if ($pscmdlet.ShouldProcess('OEM Info', 'Delete'))
|
||||
{
|
||||
# Cleanup the OEM Info
|
||||
foreach ($ValueToClean in $ValuesToClean)
|
||||
{
|
||||
$paramGetItemPropertyValue = @{
|
||||
Path = $Path
|
||||
Name = $ValueToClean
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
|
||||
if (Get-ItemPropertyValue @paramGetItemPropertyValue)
|
||||
{
|
||||
$paramRemoveItemProperty = @{
|
||||
Path = $Path
|
||||
Name = $ValueToClean
|
||||
Force = $true
|
||||
WhatIf = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
Confirm = $false
|
||||
}
|
||||
$null = (Remove-ItemProperty @paramRemoveItemProperty)
|
||||
}
|
||||
|
||||
$ValueToClean = $null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion RemoveOEMInfo
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
#region HP
|
||||
if ($ManufacturerTooling -eq 'HP')
|
||||
{
|
||||
# Cleanup the OEM Info
|
||||
$null = (Remove-OEMInfo @paramSimpleDefaults)
|
||||
|
||||
# Copy the OEM Logo
|
||||
if (Test-Path -Path "$env:HOMEDRIVE\install\ManufacturerSpecific\hp\SYSTEM.BMP" @paramSimpleDefaults)
|
||||
{
|
||||
$null = (Copy-Item -Path "$env:HOMEDRIVE\install\ManufacturerSpecific\hp\SYSTEM.BMP" @paramCopyItem)
|
||||
}
|
||||
|
||||
# Set the new OEM Info
|
||||
if ($ManufacturerModel)
|
||||
{
|
||||
$null = (New-ItemProperty -Name 'Model' -Value $ManufacturerModel @paramNewItemProperty)
|
||||
}
|
||||
|
||||
$null = (New-ItemProperty -Name 'Manufacturer' -Value 'HP Inc.' @paramNewItemProperty)
|
||||
$null = (New-ItemProperty -Name 'Logo' -Value 'C:\\WINDOWS\\SYSTEM32\\SYSTEM.BMP' @paramNewItemProperty)
|
||||
$null = (New-ItemProperty -Name 'SupportAppURL' -Value 'hpsupportassistant://GetAssist?LaunchPoint=51' @paramNewItemProperty)
|
||||
$null = (New-ItemProperty -Name 'SupportURL' -Value 'http://support.hp.com' @paramNewItemProperty)
|
||||
|
||||
# Install the HP Tools
|
||||
#region HPDefaults
|
||||
$BitsTransferPolicy = 'Always'
|
||||
$BitsTransferPriority = 'High'
|
||||
$HPSilentSwitchesExtractDefault = '/s /e /f'
|
||||
$HPSilentSwitchesDefault = '/s /a /s /v" /qn"'
|
||||
$PowerShellExecutable = ($PSHome + '\powershell.exe')
|
||||
$ErrorMessage = 'Installer not found!'
|
||||
$DriverTempDir = "$env:HOMEDRIVE\install\temp"
|
||||
#endregion HPDefaults
|
||||
|
||||
#region sp108770
|
||||
$paramTestPath = @{
|
||||
Path = $DriverTempDir
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $DriverTempDir
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
$RequestContent = 'https://ftp.hp.com/pub/softpaq/sp108501-109000/sp108770.exe'
|
||||
|
||||
$DriverExtractDest = "$env:HOMEDRIVE\install\sp108770"
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $DriverExtractDest
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $DriverExtractDest
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
[string]$Installer = ($DriverTempDir + '\sp108770.exe')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $Installer
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
# Use BitsTransfer to download the latest installer
|
||||
$paramStartBitsTransfer = @{
|
||||
Source = $RequestContent
|
||||
Destination = $Installer
|
||||
Priority = $BitsTransferPriority
|
||||
TransferPolicy = $BitsTransferPolicy
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Start-BitsTransfer @paramStartBitsTransfer)
|
||||
}
|
||||
|
||||
$HPSilentSwitchesExtract = ($HPSilentSwitchesExtractDefault + ' "' + $DriverExtractDest + '"')
|
||||
$paramStartProcess = @{
|
||||
FilePath = $PowerShellExecutable
|
||||
WorkingDirectory = $DriverExtractDest
|
||||
ArgumentList = ($Installer + ' ' + $HPSilentSwitchesExtract)
|
||||
NoNewWindow = $true
|
||||
Wait = $true
|
||||
}
|
||||
$null = (Start-Process @paramStartProcess)
|
||||
|
||||
$HPInstaller = ($DriverExtractDest + '\InstallHPSA.exe')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $HPInstaller
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$HPSilentSwitches = $HPSilentSwitchesDefault
|
||||
$paramStartProcess = @{
|
||||
FilePath = $PowerShellExecutable
|
||||
WorkingDirectory = $DriverExtractDest
|
||||
ArgumentList = ($HPInstaller + ' ' + $HPSilentSwitches)
|
||||
NoNewWindow = $true
|
||||
Wait = $true
|
||||
}
|
||||
$null = (Start-Process @paramStartProcess)
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Warning -Message $ErrorMessage
|
||||
}
|
||||
#endregion sp108770
|
||||
|
||||
#region sp107493
|
||||
$RequestContent = 'https://ftp.hp.com/pub/softpaq/sp107001-107500/sp107493.exe'
|
||||
|
||||
$DriverExtractDest = "$env:HOMEDRIVE\install\sp107493"
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $DriverExtractDest
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $DriverExtractDest
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
[string]$Installer = ($DriverTempDir + '\sp107493.exe')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $Installer
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
# Use BitsTransfer to download the latest installer
|
||||
$paramStartBitsTransfer = @{
|
||||
Source = $RequestContent
|
||||
Destination = $Installer
|
||||
Priority = $BitsTransferPriority
|
||||
TransferPolicy = $BitsTransferPolicy
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Start-BitsTransfer @paramStartBitsTransfer)
|
||||
}
|
||||
|
||||
$HPSilentSwitchesExtract = ($HPSilentSwitchesExtractDefault + ' "' + $DriverExtractDest + '"')
|
||||
$paramStartProcess = @{
|
||||
FilePath = $PowerShellExecutable
|
||||
WorkingDirectory = $DriverExtractDest
|
||||
ArgumentList = ($Installer + ' ' + $HPSilentSwitchesExtract)
|
||||
NoNewWindow = $true
|
||||
Wait = $true
|
||||
}
|
||||
$null = (Start-Process @paramStartProcess)
|
||||
|
||||
$HPInstaller = ($DriverExtractDest + '\InstallCmdWrapper.exe')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $HPInstaller
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$HPSilentSwitches = $HPSilentSwitchesDefault
|
||||
$paramStartProcess = @{
|
||||
FilePath = $PowerShellExecutable
|
||||
WorkingDirectory = $DriverExtractDest
|
||||
ArgumentList = ($HPInstaller + ' ' + $HPSilentSwitches)
|
||||
NoNewWindow = $true
|
||||
Wait = $true
|
||||
}
|
||||
$null = (Start-Process @paramStartProcess)
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Warning -Message $ErrorMessage
|
||||
}
|
||||
#endregion sp107493
|
||||
}
|
||||
#endregion HP
|
||||
|
||||
#region LENOVO
|
||||
if ($ManufacturerTooling -eq 'LENOVO')
|
||||
{
|
||||
# Cleanup the OEM Info
|
||||
$null = (Remove-OEMInfo @paramSimpleDefaults)
|
||||
|
||||
# Copy the OEM Logo
|
||||
if (Test-Path -Path 'Lenovo\SYSTEM.BMP' @paramSimpleDefaults)
|
||||
{
|
||||
$null = (Copy-Item -Path "$env:HOMEDRIVE\install\ManufacturerSpecific\Lenovo\SYSTEM.BMP" @paramCopyItem)
|
||||
}
|
||||
|
||||
# Set the new OEM Info
|
||||
if ($ManufacturerModel)
|
||||
{
|
||||
$null = (New-ItemProperty -Name 'Model' -Value $ManufacturerModel @paramNewItemProperty)
|
||||
}
|
||||
|
||||
$null = (New-ItemProperty -Name 'Manufacturer' -Value 'Lenovo' @paramNewItemProperty)
|
||||
$null = (New-ItemProperty -Name 'Logo' -Value 'C:\\WINDOWS\\SYSTEM32\\SYSTEM.BMP' @paramNewItemProperty)
|
||||
$null = (New-ItemProperty -Name 'SupportURL' -Value 'https://support.lenovo.com/' @paramNewItemProperty)
|
||||
}
|
||||
#endregion LENOVO
|
||||
|
||||
#region Dell
|
||||
if ($ManufacturerTooling -eq 'Dell')
|
||||
{
|
||||
# Cleanup the OEM Info
|
||||
$null = (Remove-OEMInfo @paramSimpleDefaults)
|
||||
|
||||
# Copy the OEM Logo
|
||||
if (Test-Path -Path "$env:HOMEDRIVE\install\ManufacturerSpecific\Dell\SYSTEM.BMP" @paramSimpleDefaults)
|
||||
{
|
||||
$null = (Copy-Item -Path "$env:HOMEDRIVE\install\ManufacturerSpecific\Dell\SYSTEM.BMP" @paramCopyItem)
|
||||
}
|
||||
|
||||
# Set the new OEM Info
|
||||
if ($ManufacturerModel)
|
||||
{
|
||||
$null = (New-ItemProperty -Name 'Model' -Value $ManufacturerModel @paramNewItemProperty)
|
||||
}
|
||||
|
||||
$null = (New-ItemProperty -Name 'Manufacturer' -Value 'Dell' @paramNewItemProperty)
|
||||
$null = (New-ItemProperty -Name 'Logo' -Value 'C:\\WINDOWS\\SYSTEM32\\SYSTEM.BMP' @paramNewItemProperty)
|
||||
$null = (New-ItemProperty -Name 'SupportURL' -Value 'https://www.dell.com/support/home/' @paramNewItemProperty)
|
||||
}
|
||||
#endregion Dell
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force @paramSimpleDefaults)
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
@@ -0,0 +1,10 @@
|
||||
title LenovoSpecific
|
||||
set Module=LenovoSpecific
|
||||
echo start %Module% %time% =================== >>%logfile_setup%
|
||||
|
||||
rem install Lenovo System Update for Windows
|
||||
echo system_update_5.07.0106.exe /VERYSILENT /SUPPRESSMSGBOXES /LOG='c:\temp\LenovoSysupdate.log' /NOCANCEL /NORESTART /CLOSEAPPLICATIONS /NORESTARTAPPLICATIONS >>%logfile_setup%
|
||||
@system_update_5.07.0106.exe /VERYSILENT /SUPPRESSMSGBOXES /LOG='c:\temp\LenovoSysupdate.log' /NOCANCEL /NORESTART /CLOSEAPPLICATIONS /NORESTARTAPPLICATIONS >>%logfile_setup%
|
||||
|
||||
echo stop %Module% %time% =================== >>%logfile_setup%
|
||||
echo.>>%logfile_setup%
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
@@ -0,0 +1,110 @@
|
||||
<Configuration ID="722e6ccf-aeaf-447b-90ea-489e3a00c6fe">
|
||||
<!-- Name the configuration -->
|
||||
<Info Description="enabling Technology default Click 2 Run installation" />
|
||||
<!-- Set plattform and update channel - The only supported channel for this kind is PerpetualVL2019 - Can be changed for Microsoft 365 activations -->
|
||||
<Add OfficeClientEdition="64" Channel="PerpetualVL2019">
|
||||
<!-- Office Suite -->
|
||||
<Product ID="ProPlus2019Volume" PIDKEY="NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP">
|
||||
<!-- Default languages to install -->
|
||||
<Language ID="de-de" />
|
||||
<Language ID="en-us" />
|
||||
<!-- Exclude some components -->
|
||||
<ExcludeApp ID="Access" />
|
||||
<ExcludeApp ID="Groove" />
|
||||
<ExcludeApp ID="Lync" />
|
||||
<ExcludeApp ID="OneDrive" />
|
||||
<ExcludeApp ID="Publisher" />
|
||||
</Product>
|
||||
<!-- Viso -->
|
||||
<Product ID="VisioPro2019Volume" PIDKEY="9BGNQ-K37YR-RQHF2-38RQ3-7VCBB">
|
||||
<!-- Default languages to install -->
|
||||
<Language ID="de-de" />
|
||||
<Language ID="en-us" />
|
||||
<!-- Exclude some components -->
|
||||
<ExcludeApp ID="Access" />
|
||||
<ExcludeApp ID="Groove" />
|
||||
<ExcludeApp ID="Lync" />
|
||||
<ExcludeApp ID="OneDrive" />
|
||||
<ExcludeApp ID="Publisher" />
|
||||
</Product>
|
||||
<!-- Project -->
|
||||
<Product ID="ProjectPro2019Volume" PIDKEY="B4NPR-3FKK7-T2MBV-FRQ4W-PKD2B">
|
||||
<!-- Default languages to install -->
|
||||
<Language ID="de-de" />
|
||||
<Language ID="en-us" />
|
||||
<!-- Exclude some components -->
|
||||
<ExcludeApp ID="Access" />
|
||||
<ExcludeApp ID="Groove" />
|
||||
<ExcludeApp ID="Lync" />
|
||||
<ExcludeApp ID="OneDrive" />
|
||||
<ExcludeApp ID="Publisher" />
|
||||
</Product>
|
||||
</Add>
|
||||
<!-- We use KMS -->
|
||||
<Property Name="SharedComputerLicensing" Value="0" />
|
||||
<!-- No default Pin's -->
|
||||
<Property Name="PinIconsToTaskbar" Value="FALSE" />
|
||||
<!-- -->
|
||||
<Property Name="SCLCacheOverride" Value="0" />
|
||||
<!-- Will only work inside the Domain network or via VPN -->
|
||||
<Property Name="AUTOACTIVATE" Value="1" />
|
||||
<!-- Kill all running Office apps -->
|
||||
<Property Name="FORCEAPPSHUTDOWN" Value="TRUE" />
|
||||
<!-- Needed for KMS -->
|
||||
<Property Name="DeviceBasedLicensing" Value="0" />
|
||||
<!-- -->
|
||||
<Updates Enabled="TRUE" />
|
||||
<!-- Remove all installed MSI -->
|
||||
<RemoveMSI />
|
||||
<!-- configure the Office apps -->
|
||||
<AppSettings>
|
||||
<!-- Who is the owner of the Office Apps -->
|
||||
<Setup Name="Company" Value="enabling Technology" />
|
||||
<!-- Settings for the proofing tools - Customized by Intune/DSC later -->
|
||||
<User Key="software\microsoft\shared tools\proofing tools\spelling" Name="germanpostreform" Value="1" Type="REG_DWORD" App="office16" Id="L_UseGermanpostreformruleswhenrunningspellcheck" />
|
||||
<!-- Settings common - Customized by Intune/DSC later -->
|
||||
<User Key="software\microsoft\office\16.0\common" Name="disabledocumentchat" Value="0" Type="REG_DWORD" App="office16" Id="L_DocumentChat" />
|
||||
<User Key="software\microsoft\office\16.0\common" Name="qmenable" Value="0" Type="REG_DWORD" App="office16" Id="L_EnableCustomerExperienceImprovementProgram" />
|
||||
<User Key="software\microsoft\office\16.0\common" Name="updatereliabilitydata" Value="1" Type="REG_DWORD" App="office16" Id="L_UpdateReliabilityPolicy" />
|
||||
<User Key="software\microsoft\office\16.0\common" Name="linkedin" Value="1" Type="REG_DWORD" App="office16" Id="L_AllowLinkedInFeatures" />
|
||||
<User Key="software\microsoft\office\16.0\common" Name="default ui theme" Value="0" Type="REG_DWORD" App="office16" Id="L_DefaultUIThemeUser" />
|
||||
<User Key="software\microsoft\office\16.0\common" Name="insiderslabbehavior" Value="1" Type="REG_DWORD" App="office16" Id="L_OfficeInsiderUserExperience" />
|
||||
<User Key="software\microsoft\office\16.0\common\feedback" Name="enabled" Value="0" Type="REG_DWORD" App="office16" Id="L_SendFeedback" />
|
||||
<User Key="software\microsoft\office\16.0\common\ptwatson" Name="ptwoptin" Value="0" Type="REG_DWORD" App="office16" Id="L_ImproveProofingTools" />
|
||||
<User Key="software\microsoft\office\16.0\common\security" Name="useisopasswordverifier" Value="1" Type="REG_DWORD" App="office16" Id="L_SetPasswordHashFormatAsISOCompliant" />
|
||||
<User Key="software\microsoft\office\16.0\common\im" Name="turnoffpresenceintegration" Value="0" Type="REG_DWORD" App="office16" Id="L_TurnOffPresenceIntegration" />
|
||||
<User Key="software\microsoft\office\16.0\common\im" Name="turnoffpresenceicon" Value="0" Type="REG_DWORD" App="office16" Id="L_ConfigurePresenceIcons" />
|
||||
<User Key="software\microsoft\office\16.0\common\internet" Name="allow8bitmime" Value="0" Type="REG_DWORD" App="office16" Id="L_WebArchiveencoding" />
|
||||
<User Key="software\microsoft\office\16.0\common\general" Name="shownfirstrunoptin" Value="1" Type="REG_DWORD" App="office16" Id="L_DisableOptinWizard" />
|
||||
<User Key="software\microsoft\office\16.0\firstrun" Name="disablemovie" Value="1" Type="REG_DWORD" App="office16" Id="L_DisableMovie" />
|
||||
<User Key="software\microsoft\office\16.0\firstrun" Name="bootedrtm" Value="1" Type="REG_DWORD" App="office16" Id="L_DisableOfficeFirstrun" />
|
||||
<User Key="software\microsoft\office\16.0\osm" Name="enableupload" Value="0" Type="REG_DWORD" App="office16" Id="L_OfficeInventoryAgentUpload" />
|
||||
<User Key="software\microsoft\office\16.0\osm" Name="enablefileobfuscation" Value="0" Type="REG_DWORD" App="office16" Id="L_OfficeInventoryAgentFilemetadataObfuscation" />
|
||||
<User Key="software\microsoft\office\16.0\osm" Name="enablelogging" Value="0" Type="REG_DWORD" App="office16" Id="L_EnableLogging" />
|
||||
<!-- Settings for Excel - Customized by Intune/DSC later -->
|
||||
<User Key="software\microsoft\office\16.0\excel" Name="dontshowwhatsnew" Value="1" Type="REG_DWORD" App="office16" Id="L_DontShowWhatsNewInformationExcel" />
|
||||
<User Key="software\microsoft\office\16.0\excel\options" Name="defaultformat" Value="51" Type="REG_DWORD" App="excel16" Id="L_SaveExcelfilesas" />
|
||||
<!-- Settings for OneNote - Customized by Intune/DSC later -->
|
||||
<User Key="software\microsoft\office\16.0\onenote" Name="dontshowwhatsnew" Value="1" Type="REG_DWORD" App="office16" Id="L_DontShowWhatsNewInformationOneNote" />
|
||||
<User Key="software\microsoft\office\16.0\onenote\options" Name="email attachment" Value="1" Type="REG_DWORD" App="onent16" Id="L_AllowOneNoteemailattachments" />
|
||||
<User Key="software\microsoft\office\16.0\onenote\options" Name="disablepresence" Value="0" Type="REG_DWORD" App="onent16" Id="L_NotebookPresence" />
|
||||
<!-- Settings for Outlook - Customized by Intune/DSC later -->
|
||||
<User Key="software\microsoft\office\16.0\outlook" Name="dontshowwhatsnew" Value="1" Type="REG_DWORD" App="office16" Id="L_DontShowWhatsNewInformationOutlook" />
|
||||
<User Key="software\microsoft\office\16.0\outlook\options\pubcal" Name="restrictedaccessonly" Value="1" Type="REG_DWORD" App="outlk16" Id="L_Accesstopublishedcalendars" />
|
||||
<User Key="software\microsoft\office\16.0\outlook\options\calendar" Name="weeknum" Value="1" Type="REG_DWORD" App="outlk16" Id="L_Calendarweeknumbers" />
|
||||
<User Key="software\microsoft\office\16.0\outlook\options" Name="enableconflictlogging" Value="2" Type="REG_DWORD" App="outlk16" Id="L_TurnOnLoggingForAllConflicts" />
|
||||
<User Key="software\microsoft\office\16.0\outlook\preferences" Name="disablemanualarchive" Value="1" Type="REG_DWORD" App="outlk16" Id="L_DisableFileArchive" />
|
||||
<!-- Settings for PowerPoint - Customized by Intune/DSC later -->
|
||||
<User Key="software\microsoft\office\16.0\powerpoint" Name="dontshowwhatsnew" Value="1" Type="REG_DWORD" App="office16" Id="L_DontShowWhatsNewInformationPowerPoint" />
|
||||
<User Key="software\microsoft\office\16.0\powerpoint\options" Name="defaultformat" Value="27" Type="REG_DWORD" App="ppt16" Id="L_SavePowerPointfilesas" />
|
||||
<!-- Settings for Visio - Customized by Intune/DSC later -->
|
||||
<User Key="software\microsoft\office\16.0\visio" Name="dontshowwhatsnew" Value="1" Type="REG_DWORD" App="office16" Id="L_DontShowWhatsNewInformationVisio" />
|
||||
<!-- Settings for Word - Customized by Intune/DSC later -->
|
||||
<User Key="software\microsoft\office\16.0\word" Name="dontshowwhatsnew" Value="1" Type="REG_DWORD" App="office16" Id="L_DontShowWhatsNewInformationWord" />
|
||||
<User Key="software\microsoft\office\16.0\word\options" Name="defaultformat" Value="" Type="REG_SZ" App="word16" Id="L_SaveWordfilesas" />
|
||||
</AppSettings>
|
||||
<!-- Do NOT show the EULA -->
|
||||
<Display Level="None" AcceptEULA="TRUE" />
|
||||
<!-- No logging -->
|
||||
<Logging Level="Off" />
|
||||
</Configuration>
|
||||
Binary file not shown.
@@ -0,0 +1,671 @@
|
||||
#requires -Version 5.0 -Modules CimCmdlets -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Set the Install Image in the Registry
|
||||
|
||||
.DESCRIPTION
|
||||
Set the Install Image in the Registry.
|
||||
Save several infos to the registry, we use that with some tools later.
|
||||
|
||||
.PARAMETER Company
|
||||
Name of the Company, used to create a registry Tree
|
||||
|
||||
.PARAMETER ImageName
|
||||
Name of the Install Image
|
||||
|
||||
.PARAMETER ImageDescription
|
||||
Description of the Install Image
|
||||
|
||||
.PARAMETER ImageVersion
|
||||
Version of the Install Image.
|
||||
String is used here!
|
||||
|
||||
.NOTES
|
||||
Changelog:
|
||||
2.0.0: Completly rewritten and renamed
|
||||
1.0.2: Add Image Name & Version
|
||||
1.0.1: Fixed the site issue (Termination Error)
|
||||
1.0.0: Initial public beta
|
||||
|
||||
Version 2.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'None')]
|
||||
param
|
||||
(
|
||||
[Parameter(ValueFromPipeline,
|
||||
ValueFromPipelineByPropertyName)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias('InstallCompany')]
|
||||
[string]
|
||||
$Company = 'enabling Technology',
|
||||
[Parameter(ValueFromPipeline,
|
||||
ValueFromPipelineByPropertyName)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias('InstallImageName')]
|
||||
[string]
|
||||
$ImageName = 'ETPOSD',
|
||||
[Parameter(ValueFromPipeline,
|
||||
ValueFromPipelineByPropertyName)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias('InstallImageDescription')]
|
||||
[string]
|
||||
$ImageDescription = 'enabling Technology progressive OS deployment',
|
||||
[Parameter(ValueFromPipeline,
|
||||
ValueFromPipelineByPropertyName)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias('InstallImageVersion')]
|
||||
[string]
|
||||
$ImageVersion = 'Test Build'
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Set the Install Image in the Registry'
|
||||
|
||||
#region GlobalDefaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
|
||||
$RegSz = 'String'
|
||||
$DefaultInfo = 'Unknown'
|
||||
|
||||
# Target Path
|
||||
$RegistryPath = ('HKLM:\Software\' + $Company + '\BaseImage')
|
||||
#endregion GlobalDefaults
|
||||
|
||||
#region HelperFunctions
|
||||
function Get-ComputerSplit
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Find the own name via DNS, use the Hostname as fallback
|
||||
|
||||
.DESCRIPTION
|
||||
Find the own name via DNS, use the Hostname as fallback
|
||||
|
||||
.PARAMETER ComputerName
|
||||
The Computer(s) to use
|
||||
|
||||
.EXAMPLE
|
||||
Get-ComputerSplit -ComputerName Value
|
||||
Describe what this call does
|
||||
|
||||
.NOTES
|
||||
Stolen from PsSharedGoods (MIT Licensed)
|
||||
|
||||
.LINK
|
||||
https://github.com/EvotecIT/PSSharedGoods
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param(
|
||||
[string[]] $ComputerName = $ComputerName
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
# Just in case
|
||||
if ($null -eq $ComputerName)
|
||||
{
|
||||
$ComputerName = ($Env:COMPUTERNAME)
|
||||
}
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
try
|
||||
{
|
||||
# Do we have a registered Hostname in DNS?
|
||||
$LocalComputerDNSName = ([Net.Dns]::GetHostByName($Env:COMPUTERNAME).HostName)
|
||||
}
|
||||
catch
|
||||
{
|
||||
# Fallback
|
||||
$LocalComputerDNSName = ($Env:COMPUTERNAME)
|
||||
}
|
||||
|
||||
# Cleanup
|
||||
$ComputersLocal = $null
|
||||
|
||||
[Array] $Computers = foreach ($_ in $ComputerName)
|
||||
{
|
||||
if ($_ -eq '' -or $null -eq $_)
|
||||
{
|
||||
$_ = ($Env:COMPUTERNAME)
|
||||
}
|
||||
|
||||
if ($_ -ne $Env:COMPUTERNAME -and $_ -ne $LocalComputerDNSName)
|
||||
{
|
||||
$_
|
||||
}
|
||||
else
|
||||
{
|
||||
$ComputersLocal = ($_)
|
||||
}
|
||||
}
|
||||
, @($ComputersLocal, $Computers)
|
||||
}
|
||||
}
|
||||
|
||||
function Get-CimData
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Get CIM Data
|
||||
|
||||
.DESCRIPTION
|
||||
Get CIM Data
|
||||
|
||||
.PARAMETER ComputerName
|
||||
Parameter description
|
||||
|
||||
.PARAMETER Protocol
|
||||
'Default', 'Dcom', 'Wsman', default is 'Default'
|
||||
|
||||
.PARAMETER Class
|
||||
CIM Class
|
||||
|
||||
.PARAMETER Properties
|
||||
CIM Property or Properties
|
||||
|
||||
.EXAMPLE
|
||||
Get-CimData -Class 'win32_bios' -ComputerName AD1,EVOWIN
|
||||
|
||||
Get-CimData -Class 'win32_bios'
|
||||
|
||||
# Get-CimClass to get all classes
|
||||
|
||||
.NOTES
|
||||
Stolen from PsSharedGoods (MIT Licensed)
|
||||
|
||||
.LINK
|
||||
https://github.com/EvotecIT/PSSharedGoods
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param([string] $Class,
|
||||
[string] $NameSpace = 'root\cimv2',
|
||||
[string[]] $ComputerName = $Env:COMPUTERNAME,
|
||||
[ValidateSet('Default', 'Dcom', 'Wsman')][string] $Protocol = 'Default',
|
||||
[string] $Properties = '*')
|
||||
|
||||
begin
|
||||
{
|
||||
$SCT = 'SilentlyContinue'
|
||||
$ExcludeProperties = 'CimClass', 'CimInstanceProperties', 'CimSystemProperties', 'SystemCreationClassName', 'CreationClassName'
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
[Array] $ComputersSplit = (Get-ComputerSplit -ComputerName $ComputerName)
|
||||
$CimObject = @(# requires removal of this property for query
|
||||
[string[]] $PropertiesOnly = $Properties | Where-Object -FilterScript {
|
||||
$_ -ne 'PSComputerName'
|
||||
}
|
||||
|
||||
$Computers = $ComputersSplit[1]
|
||||
|
||||
if ($Computers.Count -gt 0)
|
||||
{
|
||||
if ($Protocol -eq 'Default')
|
||||
{
|
||||
(Get-CimInstance -ClassName $Class -ComputerName $Computers -ErrorAction $SCT -Property $PropertiesOnly -Namespace $NameSpace | Select-Object -Property $Properties -ExcludeProperty $ExcludeProperties)
|
||||
}
|
||||
else
|
||||
{
|
||||
$Option = (New-CimSessionOption -Protocol)
|
||||
$Session = (New-CimSession -ComputerName $Computers -SessionOption $Option -ErrorAction $SCT)
|
||||
$Info = (Get-CimInstance -ClassName $Class -CimSession $Session -ErrorAction $SCT -Property $PropertiesOnly -Namespace $NameSpace | Select-Object -Property $Properties -ExcludeProperty $ExcludeProperties)
|
||||
$null = (Remove-CimSession -CimSession $Session -ErrorAction $SCT)
|
||||
|
||||
$Info
|
||||
}
|
||||
}
|
||||
|
||||
$Computers = $ComputersSplit[0]
|
||||
|
||||
if ($Computers.Count -gt 0)
|
||||
{
|
||||
$Info = (Get-CimInstance -ClassName $Class -ErrorAction $SCT -Property $PropertiesOnly -Namespace $NameSpace | Select-Object -Property $Properties -ExcludeProperty $ExcludeProperties)
|
||||
$Info | Add-Member -Name 'PSComputerName' -Value $Computers -MemberType NoteProperty -Force
|
||||
|
||||
$Info
|
||||
}
|
||||
)
|
||||
|
||||
$CimComputers = ($CimObject.PSComputerName | Sort-Object -Unique)
|
||||
|
||||
foreach ($Computer in $ComputerName)
|
||||
{
|
||||
if ($CimComputers -notcontains $Computer)
|
||||
{
|
||||
Write-Warning -Message ('Get-CimData - No data for computer {0}. Most likely an error on receiving side.' -f $Computer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
return $CimObject
|
||||
}
|
||||
}
|
||||
#endregion HelperFunctions
|
||||
|
||||
$paramSetMpPreference = @{
|
||||
EnableControlledFolderAccess = 'Disabled'
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Set-MpPreference @paramSetMpPreference)
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Create Path if needed
|
||||
$paramTestPath = @{
|
||||
Path = $RegistryPath
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $RegistryPath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
# Set Date/Time
|
||||
$InstallDate = (Get-Date -Format 'yyyy-MM-dd')
|
||||
$InstallTime = (Get-Date -Format 'HH:mm')
|
||||
|
||||
# Get system info
|
||||
$paramGetCimData = @{
|
||||
Class = 'Win32_ComputerSystem'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$HardwareInfo = (Get-CimData @paramGetCimData)
|
||||
|
||||
# Windows Info
|
||||
$paramGetCimInstance = @{
|
||||
ClassName = 'Win32_OperatingSystem'
|
||||
Property = 'CSName', 'Caption', 'Version', 'OSArchitecture'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$WindowsVersionInfo = (Get-CimInstance @paramGetCimInstance | Select-Object -Property CSName, Caption, Version, OSArchitecture)
|
||||
|
||||
# Release ID (e.g. 1903)
|
||||
$paramGetItemProperty = @{
|
||||
Path = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
|
||||
Name = 'ReleaseId'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$WindowsReleaseId = ((Get-ItemProperty @paramGetItemProperty ).ReleaseId)
|
||||
|
||||
# Network Info
|
||||
$paramGetCimInstance = @{
|
||||
ClassName = 'Win32_NetworkAdapterConfiguration'
|
||||
select = 'IPAddress'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$WindowsNicInfo = (Get-CimInstance @paramGetCimInstance | Where-Object -FilterScript {
|
||||
$_.IPAddress
|
||||
} | Select-Object -ExpandProperty IPAddress | Where-Object -FilterScript {
|
||||
$_ -notlike '*:*'
|
||||
})
|
||||
|
||||
#region ImageName
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'ImageName'
|
||||
PropertyType = $RegSz
|
||||
Value = $ImageName
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion ImageName
|
||||
|
||||
#region ImageDescription
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'ImageDescription'
|
||||
PropertyType = $RegSz
|
||||
Value = $ImageDescription
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion ImageDescription
|
||||
|
||||
#region ImageVersion
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'ImageVersion'
|
||||
PropertyType = $RegSz
|
||||
Value = $ImageVersion
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion ImageVersion
|
||||
|
||||
#region KMSAware
|
||||
$paramTestConnection = @{
|
||||
ComputerName = 'kms.enatec.net'
|
||||
Quiet = $true
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
[bool]$KMSAwareValue = (Test-Connection @paramTestConnection)
|
||||
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'KMSAware'
|
||||
PropertyType = $RegSz
|
||||
Value = $KMSAwareValue
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion KMSAware
|
||||
|
||||
#region InstallDate
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'InstallDate'
|
||||
PropertyType = $RegSz
|
||||
Value = $InstallDate
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion InstallDate
|
||||
|
||||
#region InstallTime
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'InstallTime'
|
||||
PropertyType = $RegSz
|
||||
Value = $InstallTime
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion InstallTime
|
||||
|
||||
#region InstallHostname
|
||||
if ((($HardwareInfo).Name))
|
||||
{
|
||||
$InstallHostnameValue = (($HardwareInfo).Name)
|
||||
}
|
||||
else
|
||||
{
|
||||
$InstallHostnameValue = $DefaultInfo
|
||||
}
|
||||
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'InstallHostname'
|
||||
PropertyType = $RegSz
|
||||
Value = $InstallHostnameValue
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion InstallHostname
|
||||
|
||||
#region InstallIP
|
||||
if ($WindowsNicInfo)
|
||||
{
|
||||
$InstallIPValue = $WindowsNicInfo
|
||||
}
|
||||
else
|
||||
{
|
||||
$InstallIPValue = $DefaultInfo
|
||||
}
|
||||
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'InstallIP'
|
||||
PropertyType = $RegSz
|
||||
Value = $InstallIPValue
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion InstallIP
|
||||
|
||||
#region InstallSite
|
||||
if (Test-Connection -ComputerName echo.enatec.net -Quiet -WarningAction $SCT -ErrorAction $SCT)
|
||||
{
|
||||
$InstallSiteValue = 'FRA1'
|
||||
}
|
||||
elseif (Test-Connection -ComputerName friend.enatec.net -Quiet -WarningAction $SCT -ErrorAction $SCT)
|
||||
{
|
||||
$InstallSiteValue = 'FRA2'
|
||||
}
|
||||
elseif (Test-Connection -ComputerName join.enatec.net -Quiet -WarningAction $SCT -ErrorAction $SCT)
|
||||
{
|
||||
$InstallSiteValue = 'VPN'
|
||||
}
|
||||
else
|
||||
{
|
||||
$InstallSiteValue = $DefaultInfo
|
||||
}
|
||||
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'InstallSite'
|
||||
PropertyType = $RegSz
|
||||
Value = $InstallSiteValue
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion InstallSite
|
||||
|
||||
#region HardwareManufacturer
|
||||
if ((($HardwareInfo).Manufacturer))
|
||||
{
|
||||
$HardwareManufacturerValue = (($HardwareInfo).Manufacturer)
|
||||
}
|
||||
else
|
||||
{
|
||||
$HardwareManufacturerValue = $DefaultInfo
|
||||
}
|
||||
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'HardwareManufacturer'
|
||||
PropertyType = $RegSz
|
||||
Value = $HardwareManufacturerValue
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion HardwareManufacturer
|
||||
|
||||
#region HardwareModel
|
||||
if ((($HardwareInfo).Model))
|
||||
{
|
||||
$HardwareModelValue = (($HardwareInfo).Model)
|
||||
}
|
||||
else
|
||||
{
|
||||
$HardwareModelValue = $DefaultInfo
|
||||
}
|
||||
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'HardwareModel'
|
||||
PropertyType = $RegSz
|
||||
Value = $HardwareModelValue
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion HardwareModel
|
||||
|
||||
#region InstallOperationsystem
|
||||
if ((($WindowsVersionInfo).Caption))
|
||||
{
|
||||
$InstallOperationsystemValue = (($WindowsVersionInfo).Caption)
|
||||
}
|
||||
else
|
||||
{
|
||||
$InstallOperationsystemValue = $DefaultInfo
|
||||
}
|
||||
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'InstallOperationsystem'
|
||||
PropertyType = $RegSz
|
||||
Value = $InstallOperationsystemValue
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion InstallOperationsystem
|
||||
|
||||
#region InstallArchitecture
|
||||
if ((($WindowsVersionInfo).OSArchitecture))
|
||||
{
|
||||
$InstallArchitectureValue = (($WindowsVersionInfo).OSArchitecture)
|
||||
}
|
||||
else
|
||||
{
|
||||
$InstallArchitectureValue = $DefaultInfo
|
||||
}
|
||||
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'InstallArchitecture'
|
||||
PropertyType = $RegSz
|
||||
Value = $InstallArchitectureValue
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion InstallArchitecture
|
||||
|
||||
#region InstallReleaseId
|
||||
if ($WindowsReleaseId)
|
||||
{
|
||||
$InstallReleaseIdValue = $WindowsReleaseId
|
||||
}
|
||||
else
|
||||
{
|
||||
$InstallReleaseIdValue = $DefaultInfo
|
||||
}
|
||||
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'InstallReleaseId'
|
||||
PropertyType = $RegSz
|
||||
Value = $InstallReleaseIdValue
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion InstallReleaseId
|
||||
|
||||
#region InstallVersion
|
||||
if ((($WindowsVersionInfo).Version))
|
||||
{
|
||||
$InstallVersionValue = (($WindowsVersionInfo).Version)
|
||||
}
|
||||
else
|
||||
{
|
||||
$InstallVersionValue = $DefaultInfo
|
||||
}
|
||||
|
||||
$paramNewItemProperty = @{
|
||||
Path = $RegistryPath
|
||||
Name = 'InstallVersion'
|
||||
PropertyType = $RegSz
|
||||
Value = $InstallVersionValue
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
#endregion InstallVersion
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
$paramSetMpPreference = @{
|
||||
EnableControlledFolderAccess = 'Enabled'
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Set-MpPreference @paramSetMpPreference)
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,415 @@
|
||||
@ECHO OFF
|
||||
|
||||
:: ********************************************************************************************************************
|
||||
::
|
||||
:: enabling Technology progressive OS deployment
|
||||
:: Client System Bootstrapper for Windows 10 Enterprise Installations
|
||||
::
|
||||
:: Version 1.0.0
|
||||
::
|
||||
:: Tested with Windows 10 Enterprise Release 2004 and Release 2009
|
||||
::
|
||||
:: Please review all the scripts BEFORE you install it on any of your systems.
|
||||
:: This installation/configuration is customized to our internal requirements and might not fit for everyone!
|
||||
::
|
||||
:: ********************************************************************************************************************
|
||||
|
||||
SETLOCAL
|
||||
|
||||
:: check if runs as Administrator
|
||||
OPENFILES >nul 2>&1
|
||||
IF %errorlevel%==0 (
|
||||
GOTO MakeNonCancelable
|
||||
) ELSE (
|
||||
ECHO You are not running as Administrator...
|
||||
ECHO This batch cannot do it's job without elevation!
|
||||
ECHO.
|
||||
ECHO Right-click and select ^'Run as Administrator^' and try again...
|
||||
ECHO.
|
||||
ECHO Press any key to exit...
|
||||
PAUSE >nul
|
||||
|
||||
EXIT
|
||||
)
|
||||
|
||||
:MakeNonCancelable
|
||||
:: prevent CTRL + C
|
||||
IF "%~1" EQU "NonCancelable" GOTO NonCancelable
|
||||
START "" /B CMD /C "%~F0" NonCancelable
|
||||
EXIT
|
||||
|
||||
:NonCancelable
|
||||
TITLE enabling Technology Client System Bootstrapper
|
||||
SET Module=SystemBootstrapper
|
||||
SET logfile_setup=%HOMEDRIVE%\Temp\%Module%.txt
|
||||
|
||||
:: Show Splash Screen
|
||||
START /LOW /MAX "Installation is running, please wait" c:\tools\enaTec_Installer.exe >nul 2>&1
|
||||
|
||||
:: Ensure NTP is used and that the time is correct
|
||||
%SystemRoot%\System32\net.exe stop w32time >nul 2>&1
|
||||
%SystemRoot%\System32\w32tm.exe /config /syncfromflags:manual /manualpeerlist:"0.de.pool.ntp.org 1.de.pool.ntp.org 2.de.pool.ntp.org 3.de.pool.ntp.org" >nul 2>&1
|
||||
%SystemRoot%\System32\net.exe start w32time >nul 2>&1
|
||||
%SystemRoot%\System32\sc.exe config w32time start= auto >nul 2>&1
|
||||
%SystemRoot%\System32\w32tm.exe /resync /force >nul 2>&1
|
||||
|
||||
:: Wait for the Splash Screen to load
|
||||
:LOOP
|
||||
:: Check if the Splash Screen is running
|
||||
%SystemRoot%\system32\tasklist.exe | %SystemRoot%\system32\find.exe /i "enaTec_Installer" >nul 2>&1
|
||||
IF ERRORLEVEL 1 (
|
||||
:: Wait for 5 seconds
|
||||
%SystemRoot%\system32\timeout.exe /T 5 /Nobreak >nul 2>&1
|
||||
:: Check again
|
||||
GOTO LOOP
|
||||
) ELSE (
|
||||
:: Splash Screen is running
|
||||
GOTO SetLogHeader
|
||||
)
|
||||
|
||||
:SetLogHeader
|
||||
ECHO ******************************************************************************** >%logfile_setup%
|
||||
ECHO Started %Module% on %DATE:~0% - %TIME:~0,8%
|
||||
ECHO For %COMPUTERNAME% by %USERDOMAIN%\%USERNAME% >>%logfile_setup%
|
||||
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:SetPowerPlanToHighPerformance
|
||||
ECHO Set Power Plan to High Performance
|
||||
ECHO %TIME:~0,8% Set Power Plan to High Performance >>%logfile_setup%
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "c:\scripts\PowerShell\Set-PowerPlanToHighPerformance.ps1" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
|
||||
:DisableCortanaSearchbar
|
||||
ECHO Disable Cortana Searchbar
|
||||
ECHO %TIME:~0,8% Disable Cortana Searchbar >>%logfile_setup%
|
||||
"%SystemRoot%\System32\reg.exe" ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Search" /v SearchboxTaskbarMode /t REG_DWORD /d 0 /f >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:CreatePowerShellProfiles
|
||||
ECHO Create plain PowerShell Profiles
|
||||
ECHO %TIME:~0,8% Create plain PowerShell Profiles >>%logfile_setup%
|
||||
start /MIN /WAIT "CleanupStockApps" %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "C:\scripts\PowerShell\New-PowerShellProfiles.ps1" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:ConfigureStorageSense
|
||||
ECHO Configure Storage Sense
|
||||
ECHO %TIME:~0,8% Configure Storage Sense >>%logfile_setup%
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Set-StorageSense.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:BootstrapTheUser
|
||||
ECHO Bootstrap the User
|
||||
ECHO %TIME:~0,8% Bootstrap the User >>%logfile_setup% 2>&1
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Invoke-BootstrapUser.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:ApplyTweaksLocal
|
||||
ECHO Apply tweaks local
|
||||
ECHO %TIME:~0,8% Apply tweaks local >>%logfile_setup% 2>&1
|
||||
"%SystemRoot%\System32\reg.exe" ADD HKU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v BootstrapUser /t REG_SZ /d "powershell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command '$null = (C:\scripts\PowerShell\Invoke-BootstrapUser.ps1)'" /f >>%logfile_setup% 2>&1
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:UpdateAllMicrosoftStoreApps
|
||||
ECHO Update all Microsoft Store Apps
|
||||
ECHO %TIME:~0,8% Update all Microsoft Store Apps >>%logfile_setup% 2>&1
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Update-AllMicrosoftStoreApps.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:SetOneDriveToGetInsiderBuilds
|
||||
ECHO Set OneDrive to get Insider builds
|
||||
ECHO %TIME:~0,8% Set OneDrive to get Insider builds >>%logfile_setup% 2>&1
|
||||
"%SystemRoot%\System32\reg.exe" add HKCU\Software\Microsoft\OneDrive /v EnableTeamTier_Internal /t REG_DWORD /d 1 /f >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:ForceOneDriveToUpdateAndRestart
|
||||
ECHO Force OneDrive to update and restart
|
||||
ECHO %TIME:~0,8% Force OneDrive to update and restart >>%logfile_setup% 2>&1
|
||||
C:\Windows\SysWOW64/OneDriveSetup.exe /update /restart /force >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:DownloadAndInstallLatestVersionOfMicrosoftTeams
|
||||
ECHO Download and install latest version of Microsoft Teams
|
||||
ECHO %TIME:~0,8% Download and install latest version of Microsoft Teams >>%logfile_setup% 2>&1
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Install-LatestTeamsClient.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:EnableQoSForMicrosoftTeams
|
||||
ECHO Enable QoS for Microsoft Teams
|
||||
ECHO %TIME:~0,8% Enable QoS for Microsoft Teams >>%logfile_setup% 2>&1
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Set-QoSForMicrosoftTeams.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:TweakTheFirewallForMicrosoftTeams
|
||||
ECHO Tweak the Firewall for Microsoft Teams
|
||||
ECHO %TIME:~0,8% Tweak the Firewall for Microsoft Teams >>%logfile_setup% 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Invoke-TweakTeamsClientFirewall.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:ConfigureMicrosoftDefender
|
||||
ECHO Configure Microsoft Defender
|
||||
ECHO %TIME:~0,8% Configure Microsoft Defender >>%logfile_setup% 2>&1
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Optimize-MicrosoftDefenderExclusions.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:InstallSomePowerShellModules
|
||||
ECHO Install some PowerShell Modules
|
||||
ECHO %TIME:~0,8% Install some PowerShell Modules >>%logfile_setup% 2>&1
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Install-PowerShellModules_required.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:InstallChocoWorkstationPackages
|
||||
ECHO Install Choco Workstation packages
|
||||
ECHO %TIME:~0,8% Install Choco Workstation packages >>%logfile_setup% 2>&1
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(c:\scripts\PowerShell\Install-ChocoPackages_Workstation.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:InstallWinGetFromTheGitHubRepository
|
||||
ECHO Install WinGet from the GitHub Repository
|
||||
ECHO %TIME:~0,8% Install WinGet from the GitHub Repository >>%logfile_setup%
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Install-WingetFromRepositoryRelease.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:AutomateTheDriverUpdateProcess
|
||||
ECHO Automate the driver update process
|
||||
ECHO %TIME:~0,8% Automate the driver update process >>%logfile_setup%
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -Command "(c:\scripts\PowerShell\Invoke-MSIntuneDriverUpdate.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:DesktopCleanup
|
||||
ECHO Desktop Cleanup
|
||||
ECHO %TIME:~0,8% Desktop Cleanup >>%logfile_setup% 2>&1
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Remove-AllPublicDesktopLinks.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
ECHO Set the default Start menu
|
||||
ECHO %TIME:~0,8% Set the default Start menu >>%logfile_setup%
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Set-DefaultStartMenu.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:DisableWindowsScriptHost
|
||||
:: Turn off Windows Script Host (current user only)
|
||||
ECHO Turn off Windows Script Host
|
||||
ECHO %TIME:~0,8% Turn on Windows Script Host >>%logfile_setup%
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (New-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows Script Host\Settings' -Name Enabled -PropertyType DWord -Value 0 -Force -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:EncryptTheBootDriveWithBitLocker
|
||||
ECHO Encrypt the Boot drive with BitLocker
|
||||
ECHO %TIME:~0,8% Encrypt the Boot drive with BitLocker >>%logfile_setup%
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Enable-BitLockerEncryption.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:SaveBitLockerKeyToAzureAD
|
||||
ECHO Save BitLocker Key to AzureAD
|
||||
ECHO %TIME:~0,8% Save BitLocker Key to AzureAD >>%logfile_setup%
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Invoke-BackupBitLockerKeyToAAD.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:ApplyAllPendingMicrosoftUpdates
|
||||
ECHO Apply all pending Microsoft updates
|
||||
ECHO %TIME:~0,8% Apply all pending Microsoft updates >>%logfile_setup% 2>&1
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "(C:\scripts\PowerShell\Install-AllMissingMicrosoftUpdates.ps1 -ErrorAction Continue)" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: DEFAULT
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction SilentlyContinue)" >nul 2>&1
|
||||
SC stop wsearch >nul 2>&1
|
||||
:: DEFAULT
|
||||
|
||||
:SetPowerPlanToAuto
|
||||
ECHO Set Power Plan to Auto
|
||||
ECHO %TIME:~0,8% Set Power Plan to Auto >>%logfile_setup%
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "c:\scripts\PowerShell\Set-PowerPlanToAuto.ps1" >>%logfile_setup% 2>&1
|
||||
ECHO Errorlevel=%Errorlevel% >>%logfile_setup% 2>nul
|
||||
|
||||
:: Go away
|
||||
POPD >nul 2>&1
|
||||
CD / >nul 2>&1
|
||||
|
||||
ECHO %TIME:~0,8% Bootstrap and JumpStart finished >>%logfile_setup%
|
||||
ECHO ******************************************************************************** >>%logfile_setup%
|
||||
ECHO.>>%logfile_setup% 2>nul
|
||||
|
||||
:: Initiate a restart
|
||||
SHUTDOWN -r -t 5 >nul 2>&1
|
||||
|
||||
:: Final cleanup
|
||||
IF EXIST c:\install\ rd /s /q c:\install\ >nul 2>&1
|
||||
|
||||
:: ********************************************************************************************************************
|
||||
::
|
||||
:: Changelog:
|
||||
::
|
||||
:: 0.9.0: Internal Test
|
||||
:: 1.0.0: Initial Release
|
||||
::
|
||||
:: ********************************************************************************************************************
|
||||
::
|
||||
:: License: BSD 3-Clause License
|
||||
::
|
||||
:: Copyright 2020, enabling Technology
|
||||
:: All rights reserved.
|
||||
::
|
||||
:: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
:: following conditions are met:
|
||||
:: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
|
||||
:: disclaimer.
|
||||
:: 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
|
||||
:: following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
:: 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
|
||||
:: products derived from this software without specific prior written permission.
|
||||
::
|
||||
:: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
:: INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
:: DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
:: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
:: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
:: WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
:: USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
::
|
||||
:: ********************************************************************************************************************
|
||||
::
|
||||
:: Disclaimer:
|
||||
:: - Use at your own risk, etc.
|
||||
:: - This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty
|
||||
:: in any kind
|
||||
:: - This is a third-party Software
|
||||
:: - The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its
|
||||
:: subsidiaries in any way
|
||||
:: - The Software is not supported by Microsoft Corp (MSFT)
|
||||
:: - By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
:: - If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
::
|
||||
:: ********************************************************************************************************************
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup useLegacyV2RuntimeActivationPolicy="true">
|
||||
<supportedRuntime version="v4.0" />
|
||||
<supportedRuntime version="v2.0" />
|
||||
</startup>
|
||||
<appSettings>
|
||||
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true"/>
|
||||
</appSettings>
|
||||
<runtime>
|
||||
<AppContextSwitchOverrides value="Switch.System.IO.BlockLongPaths=false;Switch.System.IO.UseLegacyPathHandling=false"/>
|
||||
</runtime>
|
||||
</configuration>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,250 @@
|
||||
#requires -Version 2.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Remove Windows 10 Stock Applications
|
||||
|
||||
.DESCRIPTION
|
||||
Remove Windows 10 Stock Applications
|
||||
|
||||
.NOTES
|
||||
Version 1.0.2
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Remove Windows 10 Stock Applications'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
#region AppList
|
||||
$AllPackages = @(
|
||||
'Microsoft.Windows.Cortana',
|
||||
'*Cortana*', 'Microsoft.Bing*',
|
||||
'Microsoft.Xbox*',
|
||||
'Microsoft.WindowsPhone',
|
||||
'*Solitaire*',
|
||||
'Microsoft.People',
|
||||
'Microsoft.Zune*',
|
||||
'Microsoft.WindowsSoundRecorder',
|
||||
'microsoft.windowscommunicationsapps',
|
||||
'Microsoft.SkypeApp',
|
||||
'officehub',
|
||||
'3dbuilder',
|
||||
'windowscamera',
|
||||
'*Dell*',
|
||||
'*Dropbox*',
|
||||
'*Facebook*',
|
||||
'Microsoft.WindowsFeedbackHub',
|
||||
'Microsoft.Getstarted',
|
||||
'*Autodesk*',
|
||||
'*Keeper*',
|
||||
'*McAfee*',
|
||||
'*Minecraft*',
|
||||
'*Netflix*',
|
||||
'Microsoft.MicrosoftOfficeHub',
|
||||
'Microsoft.OneConnect',
|
||||
'*Plex*',
|
||||
'Microsoft.SkypeApp',
|
||||
'*Solitaire*',
|
||||
'Microsoft.Office.Sway',
|
||||
'*Twitter*',
|
||||
'*DisneyMagicKingdom*',
|
||||
'*Disney*',
|
||||
'*HiddenCityMysteryofShadows*',
|
||||
'*HiddenCity*',
|
||||
'Microsoft.YourPhone',
|
||||
'Microsoft.WindowsMaps',
|
||||
'Microsoft.Print3D',
|
||||
'Microsoft.MixedReality.Portal',
|
||||
'Microsoft.Microsoft3DViewer',
|
||||
'Microsoft.GetHelp',
|
||||
'Microsoft.MicrosoftStickyNotes',
|
||||
'Microsoft.Windows.Photos'
|
||||
'Microsoft.MSPaint'
|
||||
)
|
||||
#endregion AppList
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
#region AppListLoop
|
||||
foreach ($item in $AllPackages)
|
||||
{
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
$paramRemoveAppxPackage = @{
|
||||
Confirm = $false
|
||||
PreserveApplicationData = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$paramGetAppxPackage = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Get-AppxPackage @paramGetAppxPackage | Where-Object -FilterScript {
|
||||
$_.name -like '*' + $item + '*'
|
||||
} | Remove-AppxPackage @paramRemoveAppxPackage)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Verbose -Message 'Whoopsie'
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
$paramRemoveAppxPackage = @{
|
||||
AllUsers = $true
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$paramGetAppxPackage = @{
|
||||
AllUsers = $true
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Get-AppxPackage @paramGetAppxPackage | Where-Object -FilterScript {
|
||||
$_.name -like '*' + $item + '*'
|
||||
} | Remove-AppxPackage @paramRemoveAppxPackage)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Verbose -Message 'Whoopsie'
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$paramRemoveAppxProvisionedPackage = @{
|
||||
Online = $true
|
||||
AllUsers = $true
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$paramGetAppxProvisionedPackage = @{
|
||||
Online = $true
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Get-AppxProvisionedPackage @paramGetAppxProvisionedPackage | Where-Object -FilterScript {
|
||||
$_.DisplayName -like '*' + $item + '*'
|
||||
} | Remove-AppxProvisionedPackage @paramRemoveAppxProvisionedPackage)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Verbose -Message 'Whoopsie'
|
||||
}
|
||||
}
|
||||
#endregion AppListLoop
|
||||
|
||||
#region UninstallMcAfeeSecurity
|
||||
$McAfeeSecurityApp = $null
|
||||
|
||||
$paramGetChildItem = @{
|
||||
Path = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
|
||||
$McAfeeSecurityApp = (Get-ChildItem @paramGetChildItem | ForEach-Object -Process {
|
||||
$paramGetItemProperty = @{
|
||||
Path = $_.PSPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
Get-ItemProperty @paramGetItemProperty
|
||||
} | Where-Object -FilterScript {
|
||||
$_ -match 'McAfee Security'
|
||||
} | Select-Object -ExpandProperty UninstallString)
|
||||
|
||||
if ($McAfeeSecurityApp)
|
||||
{
|
||||
$McAfeeSecurityApp = $McAfeeSecurityApp -Replace "$env:ProgramW6432\McAfee\MSC\mcuihost.exe", ''
|
||||
|
||||
$paramStartProcess = @{
|
||||
FilePath = "$env:ProgramW6432\McAfee\MSC\mcuihost.exe"
|
||||
ArgumentList = $McAfeeSecurityApp
|
||||
Wait = $true
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Start-Process @paramStartProcess)
|
||||
}
|
||||
#endregion UninstallMcAfeeSecurity
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,483 @@
|
||||
#requires -Version 3.0
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create a JSON based configuration for Chromium based Browsers
|
||||
|
||||
.DESCRIPTION
|
||||
Create and deploy a JSON based configuration for Chromium based Browsers
|
||||
|
||||
.NOTES
|
||||
For now, Chromium, Google Chrome, Microsoft Edge, and Microsoft Edge Beta are supported
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Create and deploy a JSON based configuration for Chromium based Browsers'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
#region Variables
|
||||
$DefaultHome = 'http://www.google.com/ig'
|
||||
$BrowserPath = $null
|
||||
$MasterPreferenceFile = 'master_preferences'
|
||||
#endregion Variables
|
||||
|
||||
#region ChromePreferences
|
||||
$ChromePreferences = [PSCustomObject]@{ }
|
||||
$ChromePreferences | Add-Member -NotePropertyName homepage -NotePropertyValue $DefaultHome
|
||||
$ChromePreferences | Add-Member -NotePropertyName homepage_is_newtabpage -NotePropertyValue $false
|
||||
$ChromePreferences | Add-Member -NotePropertyName browser -NotePropertyValue ([PSCustomObject]@{ })
|
||||
$ChromePreferences.browser | Add-Member -NotePropertyName show_home_button -NotePropertyValue $true
|
||||
$ChromePreferences | Add-Member -NotePropertyName session -NotePropertyValue ([PSCustomObject]@{ })
|
||||
$ChromePreferences.session | Add-Member -NotePropertyName restore_on_startup -NotePropertyValue 4
|
||||
$ChromePreferences.session | Add-Member -NotePropertyName startup_urls -NotePropertyValue (@($DefaultHome))
|
||||
$ChromePreferences | Add-Member -NotePropertyName bookmark_bar -NotePropertyValue ([PSCustomObject]@{ })
|
||||
$ChromePreferences.bookmark_bar | Add-Member -NotePropertyName show_on_all_tabs -NotePropertyValue $true
|
||||
$ChromePreferences | Add-Member -NotePropertyName sync_promo -NotePropertyValue ([PSCustomObject]@{ })
|
||||
$ChromePreferences.sync_promo | Add-Member -NotePropertyName show_on_first_run_allowed -NotePropertyValue $false
|
||||
$ChromePreferences | Add-Member -NotePropertyName distribution -NotePropertyValue ([PSCustomObject]@{ })
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName skip_first_run_ui -NotePropertyValue $true
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName import_bookmarks -NotePropertyValue $false
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName import_history -NotePropertyValue $false
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName import_search_engine -NotePropertyValue $true
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName suppress_first_run_bubble -NotePropertyValue $true
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName create_all_shortcuts -NotePropertyValue $false
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName do_not_launch_chrome -NotePropertyValue $true
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName do_not_register_for_update_launch -NotePropertyValue $true
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName do_not_create_desktop_shortcut -NotePropertyValue $true
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName do_not_create_quick_launch_shortcut -NotePropertyValue $true
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName do_not_create_taskbar_shortcut -NotePropertyValue $false
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName make_chrome_default -NotePropertyValue $false
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName ping_delay -NotePropertyValue 60
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName make_chrome_default_for_user -NotePropertyValue $false
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName suppress_first_run_default_browser_prompt -NotePropertyValue $true
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName system_level -NotePropertyValue $true
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName verbose_logging -NotePropertyValue $false
|
||||
$ChromePreferences.distribution | Add-Member -NotePropertyName allow_downgrade -NotePropertyValue $false
|
||||
$ChromePreferences | Add-Member -NotePropertyName first_run_tabs -NotePropertyValue ([PSObject]@($DefaultHome))
|
||||
$paramConvertToJson = @{
|
||||
Depth = 10
|
||||
Compress = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$ChromePreferencesJson = ($ChromePreferences | ConvertTo-Json @paramConvertToJson)
|
||||
#endregion ChromePreferences
|
||||
|
||||
#region EdgePreferences
|
||||
$EdgePreferences = [PSCustomObject]@{ }
|
||||
$EdgePreferences | Add-Member -NotePropertyName homepage_is_newtabpage -NotePropertyValue $false
|
||||
$EdgePreferences | Add-Member -NotePropertyName browser -NotePropertyValue ([PSCustomObject]@{ })
|
||||
$EdgePreferences.browser | Add-Member -NotePropertyName show_home_button -NotePropertyValue $true
|
||||
$EdgePreferences | Add-Member -NotePropertyName session -NotePropertyValue ([PSCustomObject]@{ })
|
||||
$EdgePreferences.session | Add-Member -NotePropertyName restore_on_startup -NotePropertyValue 4
|
||||
$EdgePreferences | Add-Member -NotePropertyName bookmark_bar -NotePropertyValue ([PSCustomObject]@{ })
|
||||
$EdgePreferences.bookmark_bar | Add-Member -NotePropertyName show_on_all_tabs -NotePropertyValue $true
|
||||
$EdgePreferences | Add-Member -NotePropertyName sync_promo -NotePropertyValue ([PSCustomObject]@{ })
|
||||
$EdgePreferences.sync_promo | Add-Member -NotePropertyName show_on_first_run_allowed -NotePropertyValue $false
|
||||
$EdgePreferences | Add-Member -NotePropertyName distribution -NotePropertyValue ([PSCustomObject]@{ })
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName skip_first_run_ui -NotePropertyValue $true
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName import_bookmarks -NotePropertyValue $false
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName import_history -NotePropertyValue $false
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName import_search_engine -NotePropertyValue $true
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName suppress_first_run_bubble -NotePropertyValue $true
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName create_all_shortcuts -NotePropertyValue $false
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName do_not_launch_chrome -NotePropertyValue $true
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName do_not_register_for_update_launch -NotePropertyValue $true
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName do_not_create_desktop_shortcut -NotePropertyValue $true
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName do_not_create_quick_launch_shortcut -NotePropertyValue $true
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName do_not_create_taskbar_shortcut -NotePropertyValue $false
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName make_chrome_default -NotePropertyValue $false
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName ping_delay -NotePropertyValue 60
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName make_chrome_default_for_user -NotePropertyValue $false
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName suppress_first_run_default_browser_prompt -NotePropertyValue $true
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName system_level -NotePropertyValue $true
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName verbose_logging -NotePropertyValue $false
|
||||
$EdgePreferences.distribution | Add-Member -NotePropertyName allow_downgrade -NotePropertyValue $false
|
||||
$paramConvertToJson = @{
|
||||
Depth = 10
|
||||
Compress = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$EdgePreferencesJson = ($EdgePreferences | ConvertTo-Json @paramConvertToJson)
|
||||
#endregion EdgePreferences
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
#region Chromium
|
||||
$BrowserPath = "$env:ProgramW6432\Chromium\Application\"
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $BrowserPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
Write-Verbose -Message 'Configure Chromium X64'
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
|
||||
$paramNewItem = @{
|
||||
Path = $BrowserPath
|
||||
Name = $MasterPreferenceFile
|
||||
Value = $ChromePreferencesJson
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
$BrowserPath = "${env:ProgramFiles(x86)}\Chromium\Application\"
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $BrowserPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
Write-Verbose -Message 'Configure Chromium X86'
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
|
||||
$paramNewItem = @{
|
||||
Path = $BrowserPath
|
||||
Name = $MasterPreferenceFile
|
||||
Value = $ChromePreferencesJson
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
#endregion Chromium
|
||||
|
||||
#region GoogleChrome
|
||||
$BrowserPath = "$env:ProgramW6432\Google\Chrome\Application\"
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $BrowserPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
Write-Verbose -Message 'Configure Google Chrome X64'
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
|
||||
$paramNewItem = @{
|
||||
Path = $BrowserPath
|
||||
Name = $MasterPreferenceFile
|
||||
Value = $ChromePreferencesJson
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
$BrowserPath = "${env:ProgramFiles(x86)}\Google\Chrome\Application\"
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $BrowserPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
Write-Verbose -Message 'Configure Google Chrome X86'
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
|
||||
$paramNewItem = @{
|
||||
Path = $BrowserPath
|
||||
Name = $MasterPreferenceFile
|
||||
Value = $ChromePreferencesJson
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
#endregion GoogleChrome
|
||||
|
||||
#region MicrosoftEdge
|
||||
$BrowserPath = "$env:ProgramW6432\Microsoft\Edge\Application\"
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $BrowserPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
Write-Verbose -Message 'Configure Microsoft Edge Release X64'
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
|
||||
$paramNewItem = @{
|
||||
Path = $BrowserPath
|
||||
Name = $MasterPreferenceFile
|
||||
Value = $EdgePreferencesJson
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
$BrowserPath = "${env:ProgramFiles(x86)}\Microsoft\Edge\Application\"
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $BrowserPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
Write-Verbose -Message 'Configure Microsoft Edge Release X86'
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
|
||||
$paramNewItem = @{
|
||||
Path = $BrowserPath
|
||||
Name = $MasterPreferenceFile
|
||||
Value = $EdgePreferencesJson
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
#endregion MicrosoftEdge
|
||||
|
||||
#region MicrosoftEdgeBeta
|
||||
$BrowserPath = "$env:ProgramW6432\Microsoft\Edge Beta\Application\"
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $BrowserPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
Write-Verbose -Message 'Configure Microsoft Edge Beta X64'
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
|
||||
$paramNewItem = @{
|
||||
Path = $BrowserPath
|
||||
Name = $MasterPreferenceFile
|
||||
Value = $EdgePreferencesJson
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
$BrowserPath = "${env:ProgramFiles(x86)}\Microsoft\Edge Beta\Application\"
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $BrowserPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
Write-Verbose -Message 'Configure Microsoft Edge Beta X86'
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath )
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = ($BrowserPath + $MasterPreferenceFile)
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
|
||||
$paramNewItem = @{
|
||||
Path = $BrowserPath
|
||||
Name = $MasterPreferenceFile
|
||||
Value = $EdgePreferencesJson
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
#endregion MicrosoftEdgeBeta
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,97 @@
|
||||
#requires -Version 1.0
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disable Windows Content Delivery Management
|
||||
|
||||
.DESCRIPTION
|
||||
Disable Windows Content Delivery Management
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Disable-ContentDeliveryManager.ps1
|
||||
|
||||
.NOTES
|
||||
Requested Helper
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'None')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Disable Windows Content Delivery Management'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
#region
|
||||
$ContentDeliveryManagerPath = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager'
|
||||
#endregion
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
$paramGetItem = @{
|
||||
Path = $ContentDeliveryManagerPath
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$ContentDeliveryManagerKeys = (Get-Item @paramGetItem)
|
||||
|
||||
$ContentDeliveryManagerKeys.GetValueNames() | ForEach-Object -Process {
|
||||
if ($ContentDeliveryManagerKeys.GetValueKind($_) -eq 'DWord')
|
||||
{
|
||||
$paramSetItemProperty = @{
|
||||
Path = $ContentDeliveryManagerPath
|
||||
Name = $_
|
||||
Value = 0
|
||||
Force = $true
|
||||
WhatIf = $true
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
Confirm = $false
|
||||
}
|
||||
$null = (Set-ItemProperty @paramSetItemProperty)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
exit (0)
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,964 @@
|
||||
#requires -Version 5.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Enable BitLocker with both TPM and recovery password key protectors on Windows 10 devices.
|
||||
|
||||
.DESCRIPTION
|
||||
Enable BitLocker with both TPM and recovery password key protectors on Windows 10 devices.
|
||||
|
||||
.PARAMETER EncryptionMethod
|
||||
Define the encryption method to be used when enabling BitLocker.
|
||||
|
||||
.PARAMETER OperationalMode
|
||||
Set the operational mode of this script.
|
||||
|
||||
.PARAMETER CompanyName
|
||||
Set the company name to be used as registry root when running in Backup mode.
|
||||
|
||||
.NOTES
|
||||
Version 1.0.1
|
||||
|
||||
Adopted version of Enable-BitLockerEncryption.ps1 from Nickolaj Andersen (@NickolajA)
|
||||
#>
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param (
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[ValidateSet('Aes128', 'Aes256', 'XtsAes128', 'XtsAes256')]
|
||||
[string]
|
||||
$EncryptionMethod = 'XtsAes256',
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[ValidateSet('Encrypt', 'Backup')]
|
||||
[string]
|
||||
$OperationalMode = 'Encrypt',
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$CompanyName = 'enabling Technology'
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Enable BitLocker with both TPM and recovery password key protectors'
|
||||
|
||||
#region
|
||||
$STP = 'Stop'
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
#region
|
||||
function Write-LogEntry
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Describe purpose of "Write-LogEntry" in 1-2 sentences.
|
||||
|
||||
.DESCRIPTION
|
||||
Add a more complete description of what the function does.
|
||||
|
||||
.PARAMETER Value
|
||||
Describe parameter -Value.
|
||||
|
||||
.PARAMETER Severity
|
||||
Describe parameter -Severity.
|
||||
|
||||
.EXAMPLE
|
||||
Write-LogEntry -Value Value -Severity Value
|
||||
Describe what this call does
|
||||
|
||||
.NOTES
|
||||
Place additional notes here.
|
||||
|
||||
.LINK
|
||||
URLs to related sites
|
||||
The first link is opened by Get-Help -Online Write-LogEntry
|
||||
|
||||
.INPUTS
|
||||
List of input types that are accepted by this function.
|
||||
|
||||
.OUTPUTS
|
||||
List of output types produced by this function.
|
||||
#>
|
||||
param (
|
||||
[parameter(Mandatory, HelpMessage = 'Value added to the log file.')]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Value,
|
||||
[parameter(Mandatory, HelpMessage = 'Severity for the log entry. 1 for Informational, 2 for Warning and 3 for Error.')]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[ValidateSet('1', '2', '3')]
|
||||
[string]
|
||||
$Severity
|
||||
)
|
||||
begin
|
||||
{
|
||||
$SCT = 'SilentlyContinue'
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Determine log file location
|
||||
$paramJoinPath = @{
|
||||
Path = (Join-Path -Path $env:windir -ChildPath 'Temp' -ErrorAction $SCT)
|
||||
ChildPath = 'Enable-BitLockerEncryption.log'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$LogFilePath = (Join-Path @paramJoinPath)
|
||||
|
||||
# Construct time stamp for log entry
|
||||
$paramTestPath = @{
|
||||
Path = 'variable:global:TimezoneBias'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
[string]$global:TimezoneBias = [TimeZoneInfo]::Local.GetUtcOffset((Get-Date)).TotalMinutes
|
||||
|
||||
if ($TimezoneBias -match '^-')
|
||||
{
|
||||
$TimezoneBias = $TimezoneBias.Replace('-', '+')
|
||||
}
|
||||
else
|
||||
{
|
||||
$TimezoneBias = '-' + $TimezoneBias
|
||||
}
|
||||
}
|
||||
|
||||
$Time = -join @((Get-Date -Format 'HH:mm:ss.fff'), $TimezoneBias)
|
||||
|
||||
# Construct date for log entry
|
||||
$Date = (Get-Date -Format 'MM-dd-yyyy')
|
||||
|
||||
# Construct context for log entry
|
||||
$Context = $([Security.Principal.WindowsIdentity]::GetCurrent().Name)
|
||||
|
||||
# Construct final log entry
|
||||
$LogText = "<![LOG[$($Value)]LOG]!><time=""$($Time)"" date=""$($Date)"" component=""BitLockerEncryption"" context=""$($Context)"" type=""$($Severity)"" thread=""$($PID)"" file="""">"
|
||||
|
||||
# Add value to log file
|
||||
try
|
||||
{
|
||||
$paramOutFile = @{
|
||||
Append = $true
|
||||
NoClobber = $true
|
||||
Encoding = 'Default'
|
||||
FilePath = $LogFilePath
|
||||
ErrorAction = 'Stop'
|
||||
}
|
||||
$null = ($LogText | Out-File @paramOutFile)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message "Unable to append log entry to Enable-BitLockerEncryption.log file. Error message at line $($_.InvocationInfo.ScriptLineNumber): $($_.Exception.Message)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-Executable
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Describe purpose of "Invoke-Executable" in 1-2 sentences.
|
||||
|
||||
.DESCRIPTION
|
||||
Add a more complete description of what the function does.
|
||||
|
||||
.PARAMETER FilePath
|
||||
Describe parameter -FilePath.
|
||||
|
||||
.PARAMETER Arguments
|
||||
Describe parameter -Arguments.
|
||||
|
||||
.EXAMPLE
|
||||
Invoke-Executable -FilePath Value -Arguments Value
|
||||
Describe what this call does
|
||||
|
||||
.NOTES
|
||||
Place additional notes here.
|
||||
|
||||
.LINK
|
||||
URLs to related sites
|
||||
The first link is opened by Get-Help -Online Invoke-Executable
|
||||
|
||||
.INPUTS
|
||||
List of input types that are accepted by this function.
|
||||
|
||||
.OUTPUTS
|
||||
List of output types produced by this function.
|
||||
#>
|
||||
param (
|
||||
[parameter(Mandatory, HelpMessage = 'Specify the file name or path of the executable to be invoked, including the extension')]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$FilePath,
|
||||
[ValidateNotNull()]
|
||||
[string]
|
||||
$Arguments
|
||||
)
|
||||
|
||||
process
|
||||
{
|
||||
# Construct a hash-table for default parameter splatting
|
||||
$SplatArgs = @{
|
||||
FilePath = $FilePath
|
||||
NoNewWindow = $true
|
||||
Passthru = $true
|
||||
RedirectStandardOutput = 'null.txt'
|
||||
ErrorAction = 'Stop'
|
||||
}
|
||||
|
||||
# Add ArgumentList param if present
|
||||
if (-not ([string]::IsNullOrEmpty($Arguments)))
|
||||
{
|
||||
$SplatArgs.Add('ArgumentList', $Arguments)
|
||||
}
|
||||
|
||||
# Invoke executable and wait for process to exit
|
||||
try
|
||||
{
|
||||
$Invocation = (Start-Process @SplatArgs)
|
||||
$Handle = $Invocation.Handle
|
||||
$Invocation.WaitForExit()
|
||||
|
||||
# Remove redirected output file
|
||||
$paramRemoveItem = @{
|
||||
Path = (Join-Path -Path $PSScriptRoot -ChildPath 'null.txt' -ErrorAction Continue)
|
||||
Force = $true
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message $_.Exception.Message
|
||||
break
|
||||
}
|
||||
|
||||
return $Invocation.ExitCode
|
||||
}
|
||||
}
|
||||
|
||||
function Test-RegistryValue
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Describe purpose of "Test-RegistryValue" in 1-2 sentences.
|
||||
|
||||
.DESCRIPTION
|
||||
Add a more complete description of what the function does.
|
||||
|
||||
.PARAMETER Path
|
||||
Describe parameter -Path.
|
||||
|
||||
.PARAMETER Name
|
||||
Describe parameter -Name.
|
||||
|
||||
.EXAMPLE
|
||||
Test-RegistryValue -Path Value -Name Value
|
||||
Describe what this call does
|
||||
|
||||
.NOTES
|
||||
Place additional notes here.
|
||||
|
||||
.LINK
|
||||
URLs to related sites
|
||||
The first link is opened by Get-Help -Online Test-RegistryValue
|
||||
|
||||
.INPUTS
|
||||
List of input types that are accepted by this function.
|
||||
|
||||
.OUTPUTS
|
||||
List of output types produced by this function.
|
||||
#>
|
||||
param (
|
||||
[parameter(Mandatory, HelpMessage = 'Add help message for user')]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Path,
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Name
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
# If item property value exists return True, else catch the failure and return False
|
||||
$STP = 'Stop'
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
try
|
||||
{
|
||||
if ($PSBoundParameters['Name'])
|
||||
{
|
||||
$paramGetItemProperty = @{
|
||||
Path = $Path
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$Existence = (Get-ItemProperty @paramGetItemProperty | Select-Object -ExpandProperty $Name -ErrorAction $STP)
|
||||
}
|
||||
else
|
||||
{
|
||||
$paramGetItemProperty = @{
|
||||
Path = $Path
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$Existence = (Get-ItemProperty @paramGetItemProperty)
|
||||
}
|
||||
|
||||
if ($Existence)
|
||||
{
|
||||
return $true
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return $false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Set-RegistryValue
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Describe purpose of "Set-RegistryValue" in 1-2 sentences.
|
||||
|
||||
.DESCRIPTION
|
||||
Add a more complete description of what the function does.
|
||||
|
||||
.PARAMETER Path
|
||||
Describe parameter -Path.
|
||||
|
||||
.PARAMETER Name
|
||||
Describe parameter -Name.
|
||||
|
||||
.PARAMETER Value
|
||||
Describe parameter -Value.
|
||||
|
||||
.EXAMPLE
|
||||
Set-RegistryValue -Path Value -Name Value -Value Value
|
||||
Describe what this call does
|
||||
|
||||
.NOTES
|
||||
Place additional notes here.
|
||||
|
||||
.LINK
|
||||
URLs to related sites
|
||||
The first link is opened by Get-Help -Online Set-RegistryValue
|
||||
|
||||
.INPUTS
|
||||
List of input types that are accepted by this function.
|
||||
|
||||
.OUTPUTS
|
||||
List of output types produced by this function.
|
||||
#>
|
||||
param (
|
||||
[parameter(Mandatory, HelpMessage = 'Add help message for user')]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Path,
|
||||
[parameter(Mandatory, HelpMessage = 'Add help message for user')]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Name,
|
||||
[parameter(Mandatory, HelpMessage = 'Add help message for user')]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Value
|
||||
)
|
||||
begin
|
||||
{
|
||||
$SCT = 'SilentlyContinue'
|
||||
$STP = 'Stop'
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
try
|
||||
{
|
||||
$paramGetItemProperty = @{
|
||||
Path = $Path
|
||||
Name = $Name
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$RegistryValue = (Get-ItemProperty @paramGetItemProperty)
|
||||
|
||||
if ($RegistryValue)
|
||||
{
|
||||
$paramSetItemProperty = @{
|
||||
Path = $Path
|
||||
Name = $Name
|
||||
Value = $Value
|
||||
Force = $true
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Set-ItemProperty @paramSetItemProperty)
|
||||
}
|
||||
else
|
||||
{
|
||||
$paramNewItemProperty = @{
|
||||
Path = $Path
|
||||
Name = $Name
|
||||
PropertyType = 'String'
|
||||
Value = $Value
|
||||
Force = $true
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "Failed to create or update registry value '$($Name)' in '$($Path)'. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Check if we're running as a 64-bit process or not
|
||||
if (-not [Environment]::Is64BitProcess)
|
||||
{
|
||||
# Get the sysnative path for powershell.exe
|
||||
$paramJoinPath = @{
|
||||
Path = ($PSHOME.ToLower().Replace('syswow64', 'sysnative'))
|
||||
ChildPath = 'powershell.exe'
|
||||
}
|
||||
$SysNativePowerShell = (Join-Path @paramJoinPath)
|
||||
|
||||
# Construct new ProcessStartInfo object to restart powershell.exe as a 64-bit process and re-run scipt
|
||||
$ProcessStartInfo = (New-Object -TypeName System.Diagnostics.ProcessStartInfo)
|
||||
$ProcessStartInfo.FileName = $SysNativePowerShell
|
||||
$ProcessStartInfo.Arguments = "-ExecutionPolicy Bypass -File ""$($PSCommandPath)"""
|
||||
$ProcessStartInfo.RedirectStandardOutput = $true
|
||||
$ProcessStartInfo.RedirectStandardError = $true
|
||||
$ProcessStartInfo.UseShellExecute = $false
|
||||
$ProcessStartInfo.WindowStyle = 'Hidden'
|
||||
$ProcessStartInfo.CreateNoWindow = $true
|
||||
|
||||
# Instatiate the new 64-bit process
|
||||
$Process = [Diagnostics.Process]::Start($ProcessStartInfo)
|
||||
|
||||
# Read standard error output to determine if the 64-bit script process somehow failed
|
||||
$ErrorOutput = $Process.StandardError.ReadToEnd()
|
||||
|
||||
if ($ErrorOutput)
|
||||
{
|
||||
Write-Error -Message $ErrorOutput
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
# Define the company registry root key
|
||||
$RegistryRootPath = "HKLM:\SOFTWARE\$($CompanyName)"
|
||||
|
||||
if (-not (Test-RegistryValue -Path $RegistryRootPath))
|
||||
{
|
||||
Write-LogEntry -Value 'Attempting to create registry root path for recovery password escrow results' -Severity 1
|
||||
|
||||
$paramNewItem = @{
|
||||
Path = $RegistryRootPath
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "An error occurred while creating registry root item '$($RegistryRootPath)'. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
|
||||
# Switch execution context depending on selected operational mode for the script as parameter input
|
||||
switch ($OperationalMode)
|
||||
{
|
||||
'Encrypt'
|
||||
{
|
||||
Write-LogEntry -Value "Current operational mode for script: $($OperationalMode)" -Severity 1
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
# Check if TPM chip is currently owned, if not take ownership
|
||||
$paramGetWmiObject = @{
|
||||
Namespace = 'root\cimv2\Security\MicrosoftTPM'
|
||||
Class = 'Win32_TPM'
|
||||
}
|
||||
$TPMClass = (Get-WmiObject @paramGetWmiObject)
|
||||
$IsTPMOwned = $TPMClass.IsOwned().IsOwned
|
||||
|
||||
if ($IsTPMOwned -eq $false)
|
||||
{
|
||||
Write-LogEntry -Value "TPM chip is currently not owned, value from WMI class method 'IsOwned' was: $($IsTPMOwned)" -Severity 1
|
||||
|
||||
# Generate a random pass phrase to be used when taking ownership of TPM chip
|
||||
$NewPassPhrase = (New-Guid).Guid.Replace('-', '').SubString(0, 14)
|
||||
|
||||
# Construct owner auth encoded string
|
||||
$NewOwnerAuth = $TPMClass.ConvertToOwnerAuth($NewPassPhrase).OwnerAuth
|
||||
|
||||
# Attempt to take ownership of TPM chip
|
||||
$Invocation = $TPMClass.TakeOwnership($NewOwnerAuth)
|
||||
|
||||
if ($Invocation.ReturnValue -eq 0)
|
||||
{
|
||||
Write-LogEntry -Value 'TPM chip ownership was successfully taken' -Severity 1
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-LogEntry -Value "Failed to take ownership of TPM chip, return value from invocation: $($Invocation.ReturnValue)" -Severity 3
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-LogEntry -Value 'TPM chip is currently owned, will not attempt to take ownership' -Severity 1
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "An error occurred while taking ownership of TPM chip. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
# Retrieve the current encryption status of the operating system drive
|
||||
Write-LogEntry -Value 'Attempting to retrieve the current encryption status of the operating system drive' -Severity 1
|
||||
|
||||
$paramGetBitLockerVolume = @{
|
||||
MountPoint = $env:SystemRoot
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$BitLockerOSVolume = (Get-BitLockerVolume @paramGetBitLockerVolume)
|
||||
|
||||
if ($BitLockerOSVolume)
|
||||
{
|
||||
# Determine whether BitLocker is turned on or off
|
||||
if (($BitLockerOSVolume.VolumeStatus -like 'FullyDecrypted') -or ($BitLockerOSVolume.KeyProtector.Count -eq 0))
|
||||
{
|
||||
Write-LogEntry -Value "Current encryption status of the operating system drive was detected as: $($BitLockerOSVolume.VolumeStatus)" -Severity 1
|
||||
|
||||
try
|
||||
{
|
||||
# Enable BitLocker with TPM key protector
|
||||
Write-LogEntry -Value "Attempting to enable BitLocker protection with TPM key protector for mount point: $($env:SystemRoot)" -Severity 1
|
||||
|
||||
$paramEnableBitLocker = @{
|
||||
MountPoint = $BitLockerOSVolume.MountPoint
|
||||
TpmProtector = $true
|
||||
UsedSpaceOnly = $true
|
||||
EncryptionMethod = $EncryptionMethod
|
||||
SkipHardwareTest = $true
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Enable-BitLocker @paramEnableBitLocker)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "An error occurred while enabling BitLocker with TPM key protector for mount point '$($env:SystemRoot)'. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
# Enable BitLocker with recovery password key protector
|
||||
Write-LogEntry -Value "Attempting to enable BitLocker protection with recovery password key protector for mount point: $($env:SystemRoot)" -Severity 1
|
||||
|
||||
$paramEnableBitLocker = @{
|
||||
MountPoint = $BitLockerOSVolume.MountPoint
|
||||
RecoveryPasswordProtector = $true
|
||||
UsedSpaceOnly = $true
|
||||
EncryptionMethod = $EncryptionMethod
|
||||
SkipHardwareTest = $true
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Enable-BitLocker @paramEnableBitLocker)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "An error occurred while enabling BitLocker with recovery password key protector for mount point '$($env:SystemRoot)'. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
}
|
||||
elseif (($BitLockerOSVolume.VolumeStatus -like 'FullyEncrypted') -or ($BitLockerOSVolume.VolumeStatus -like 'UsedSpaceOnly'))
|
||||
{
|
||||
Write-LogEntry -Value "Current encryption status of the operating system drive was detected as: $($BitLockerOSVolume.VolumeStatus)" -Severity 1
|
||||
Write-LogEntry -Value 'Validating that all desired key protectors are enabled' -Severity 1
|
||||
|
||||
# Validate that not only the TPM protector is enabled, add recovery password protector
|
||||
if ($BitLockerOSVolume.KeyProtector.Count -lt 2)
|
||||
{
|
||||
if ($BitLockerOSVolume.KeyProtector.KeyProtectorType -like 'Tpm')
|
||||
{
|
||||
Write-LogEntry -Value 'Recovery password key protector is not present' -Severity 1
|
||||
|
||||
try
|
||||
{
|
||||
# Enable BitLocker with TPM key protector
|
||||
Write-LogEntry -Value "Attempting to enable BitLocker protection with recovery password key protector for mount point: $($env:SystemRoot)" -Severity 1
|
||||
|
||||
$paramEnableBitLocker = @{
|
||||
MountPoint = $BitLockerOSVolume.MountPoint
|
||||
RecoveryPasswordProtector = $true
|
||||
UsedSpaceOnly = $true
|
||||
EncryptionMethod = $EncryptionMethod
|
||||
SkipHardwareTest = $true
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Enable-BitLocker @paramEnableBitLocker)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "An error occurred while enabling BitLocker with TPM key protector for mount point '$($env:SystemRoot)'. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
}
|
||||
|
||||
if ($BitLockerOSVolume.KeyProtector.KeyProtectorType -like 'RecoveryPassword')
|
||||
{
|
||||
Write-LogEntry -Value 'TPM key protector is not present' -Severity 1
|
||||
|
||||
try
|
||||
{
|
||||
# Add BitLocker recovery password key protector
|
||||
Write-LogEntry -Value "Attempting to enable BitLocker protection with TPM key protector for mount point: $($env:SystemRoot)" -Severity 1
|
||||
|
||||
$paramEnableBitLocker = @{
|
||||
MountPoint = $BitLockerOSVolume.MountPoint
|
||||
TpmProtector = $true
|
||||
UsedSpaceOnly = $true
|
||||
EncryptionMethod = $EncryptionMethod
|
||||
SkipHardwareTest = $true
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Enable-BitLocker @paramEnableBitLocker)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "An error occurred while enabling BitLocker with recovery password key protector for mount point '$($env:SystemRoot)'. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# BitLocker is in wait state
|
||||
Invoke-Executable -FilePath 'manage-bde.exe' -Arguments "-On $($BitLockerOSVolume.MountPoint) -UsedSpaceOnly"
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-LogEntry -Value "Current encryption status of the operating system drive was detected as: $($BitLockerOSVolume.VolumeStatus)" -Severity 1
|
||||
}
|
||||
|
||||
# Validate that previous configuration was successful and all key protectors have been enabled and encryption is on
|
||||
$paramGetBitLockerVolume = @{
|
||||
MountPoint = $env:SystemRoot
|
||||
}
|
||||
$BitLockerOSVolume = (Get-BitLockerVolume @paramGetBitLockerVolume)
|
||||
|
||||
# Wait for encryption to complete
|
||||
if ($BitLockerOSVolume.VolumeStatus -like 'EncryptionInProgress')
|
||||
{
|
||||
do
|
||||
{
|
||||
$paramGetBitLockerVolume = @{
|
||||
MountPoint = $env:SystemRoot
|
||||
}
|
||||
$BitLockerOSVolume = (Get-BitLockerVolume @paramGetBitLockerVolume)
|
||||
|
||||
Write-LogEntry -Value "Current encryption percentage progress: $($BitLockerOSVolume.EncryptionPercentage)" -Severity 1
|
||||
Write-LogEntry -Value 'Waiting for BitLocker encryption progress to complete, sleeping for 15 seconds' -Severity 1
|
||||
|
||||
Start-Sleep -Seconds 15
|
||||
}
|
||||
until ($BitLockerOSVolume.EncryptionPercentage -eq 100)
|
||||
|
||||
Write-LogEntry -Value 'Encryption of operating system drive has now completed' -Severity 1
|
||||
}
|
||||
|
||||
if (($BitLockerOSVolume.VolumeStatus -like 'FullyEncrypted') -and ($BitLockerOSVolume.KeyProtector.Count -eq 2))
|
||||
{
|
||||
try
|
||||
{
|
||||
# Attempt to backup recovery password to Azure AD device object
|
||||
Write-LogEntry -Value 'Attempting to backup recovery password to Azure AD device object' -Severity 1
|
||||
|
||||
$RecoveryPasswordKeyProtector = $BitLockerOSVolume.KeyProtector | Where-Object {
|
||||
$_.KeyProtectorType -like 'RecoveryPassword'
|
||||
}
|
||||
|
||||
if ($RecoveryPasswordKeyProtector)
|
||||
{
|
||||
$paramBackupToAADBitLockerKeyProtector = @{
|
||||
MountPoint = $BitLockerOSVolume.MountPoint
|
||||
KeyProtectorId = $RecoveryPasswordKeyProtector.KeyProtectorId
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (BackupToAAD-BitLockerKeyProtector @paramBackupToAADBitLockerKeyProtector)
|
||||
|
||||
Write-LogEntry -Value 'Successfully backed up recovery password details' -Severity 1
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-LogEntry -Value 'Unable to determine proper recovery password key protector for backing up of recovery password details' -Severity 2
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "An error occurred while attempting to backup recovery password to Azure AD. Error message: $($_.Exception.Message)" -Severity 3
|
||||
|
||||
# Copy executing script to system temporary directory
|
||||
Write-LogEntry -Value 'Attempting to copy executing script to system temporary directory' -Severity 1
|
||||
|
||||
$paramJoinPath = @{
|
||||
Path = $env:SystemRoot
|
||||
ChildPath = 'Temp'
|
||||
}
|
||||
$SystemTemp = (Join-Path @paramJoinPath)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = (Join-Path -Path $SystemTemp -ChildPath "$($MyInvocation.MyCommand.Name)")
|
||||
PathType = 'Leaf'
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
# Copy executing script
|
||||
Write-LogEntry -Value 'Copying executing script to staging folder for scheduled task usage' -Severity 1
|
||||
|
||||
$paramCopyItem = @{
|
||||
Path = $MyInvocation.MyCommand.Definition
|
||||
Destination = $SystemTemp
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
|
||||
try
|
||||
{
|
||||
# Create escrow scheduled task to backup recovery password to Azure AD at a later time
|
||||
$paramNewScheduledTaskAction = @{
|
||||
Execute = 'powershell.exe'
|
||||
Argument = "-ExecutionPolicy Bypass -NoProfile -File $($SystemTemp)\$($MyInvocation.MyCommand.Name) -OperationalMode Backup"
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$TaskAction = (New-ScheduledTaskAction @paramNewScheduledTaskAction)
|
||||
|
||||
$paramNewScheduledTaskTrigger = @{
|
||||
AtLogOn = $true
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$TaskTrigger = (New-ScheduledTaskTrigger @paramNewScheduledTaskTrigger)
|
||||
|
||||
$paramNewScheduledTaskSettingsSet = @{
|
||||
AllowStartIfOnBatteries = $true
|
||||
Hidden = $true
|
||||
DontStopIfGoingOnBatteries = $true
|
||||
Compatibility = 'Win8'
|
||||
RunOnlyIfNetworkAvailable = $true
|
||||
MultipleInstances = 'IgnoreNew'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$TaskSettings = (New-ScheduledTaskSettingsSet @paramNewScheduledTaskSettingsSet)
|
||||
|
||||
$paramNewScheduledTaskPrincipal = @{
|
||||
UserId = 'NT AUTHORITY\SYSTEM'
|
||||
LogonType = 'ServiceAccount'
|
||||
RunLevel = 'Highest'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$TaskPrincipal = (New-ScheduledTaskPrincipal @paramNewScheduledTaskPrincipal)
|
||||
|
||||
$paramNewScheduledTask = @{
|
||||
Action = $TaskAction
|
||||
Principal = $TaskPrincipal
|
||||
Settings = $TaskSettings
|
||||
Trigger = $TaskTrigger
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$ScheduledTask = (New-ScheduledTask @paramNewScheduledTask)
|
||||
|
||||
$paramRegisterScheduledTask = @{
|
||||
InputObject = $ScheduledTask
|
||||
TaskName = 'Backup BitLocker Recovery Password to Azure AD'
|
||||
TaskPath = '\Microsoft'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Register-ScheduledTask @paramRegisterScheduledTask)
|
||||
|
||||
try
|
||||
{
|
||||
# Attempt to create BitLocker recovery password escrow registry value
|
||||
$paramTestRegistryValue = @{
|
||||
Path = $RegistryRootPath
|
||||
Name = 'BitLockerEscrowResult'
|
||||
}
|
||||
if (-not (Test-RegistryValue @paramTestRegistryValue))
|
||||
{
|
||||
Write-LogEntry -Value "Setting initial 'BitLockerEscrowResult' registry value to: None" -Severity 1
|
||||
|
||||
$paramSetRegistryValue = @{
|
||||
Path = $RegistryRootPath
|
||||
Name = 'BitLockerEscrowResult'
|
||||
Value = 'None'
|
||||
}
|
||||
$null = (Set-RegistryValue @paramSetRegistryValue)
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "Unable to register scheduled task for backup of recovery password. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "Unable to register scheduled task for backup of recovery password. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "Unable to stage script in system temporary directory for scheduled task. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-LogEntry -Value 'Validation of current encryption status for operating system drive was not successful' -Severity 2
|
||||
Write-LogEntry -Value "Current volume status for mount point '$($BitLockerOSVolume.MountPoint)': $($BitLockerOSVolume.VolumeStatus)" -Severity 2
|
||||
Write-LogEntry -Value "Count of enabled key protectors for volume: $($BitLockerOSVolume.KeyProtector.Count)" -Severity 2
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-LogEntry -Value 'Current encryption status query returned an empty result, this was not expected at this point' -Severity 2
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "An error occurred while retrieving the current encryption status of operating system drive. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "An error occurred while importing the BitLocker module. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
}
|
||||
'Backup'
|
||||
{
|
||||
Write-LogEntry -Value "Current operational mode for script: $($OperationalMode)" -Severity 1
|
||||
|
||||
# Retrieve the current encryption status of the operating system drive
|
||||
$paramGetBitLockerVolume = @{
|
||||
MountPoint = $env:SystemRoot
|
||||
}
|
||||
$BitLockerOSVolume = (Get-BitLockerVolume @paramGetBitLockerVolume)
|
||||
|
||||
# Attempt to backup recovery password to Azure AD device object if volume is encrypted
|
||||
if (($BitLockerOSVolume.VolumeStatus -like 'FullyEncrypted') -and ($BitLockerOSVolume.KeyProtector.Count -eq 2))
|
||||
{
|
||||
try
|
||||
{
|
||||
$paramGetItemPropertyValue = @{
|
||||
Path = $RegistryRootPath
|
||||
Name = 'BitLockerEscrowResult'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$BitLockerEscrowResultsValue = (Get-ItemPropertyValue @paramGetItemPropertyValue)
|
||||
|
||||
if ($BitLockerEscrowResultsValue -match 'None|False')
|
||||
{
|
||||
try
|
||||
{
|
||||
Write-LogEntry -Value 'Attempting to backup recovery password to Azure AD device object' -Severity 1
|
||||
|
||||
$RecoveryPasswordKeyProtector = $BitLockerOSVolume.KeyProtector | Where-Object {
|
||||
$_.KeyProtectorType -like 'RecoveryPassword'
|
||||
}
|
||||
|
||||
if ($RecoveryPasswordKeyProtector)
|
||||
{
|
||||
$paramBackupToAADBitLockerKeyProtector = @{
|
||||
MountPoint = $BitLockerOSVolume.MountPoint
|
||||
KeyProtectorId = $RecoveryPasswordKeyProtector.KeyProtectorId
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (BackupToAAD-BitLockerKeyProtector @paramBackupToAADBitLockerKeyProtector)
|
||||
|
||||
$paramSetRegistryValue = @{
|
||||
Path = $RegistryRootPath
|
||||
Name = 'BitLockerEscrowResult'
|
||||
Value = 'True'
|
||||
}
|
||||
$null = (Set-RegistryValue @paramSetRegistryValue)
|
||||
|
||||
Write-LogEntry -Value 'Successfully backed up recovery password details' -Severity 1
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-LogEntry -Value 'Unable to determine proper recovery password key protector for backing up of recovery password details' -Severity 2
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "An error occurred while attempting to backup recovery password to Azure AD. Error message: $($_.Exception.Message)" -Severity 3
|
||||
|
||||
$paramSetRegistryValue = @{
|
||||
Path = $RegistryRootPath
|
||||
Name = 'BitLockerEscrowResult'
|
||||
Value = 'False'
|
||||
}
|
||||
$null = (Set-RegistryValue @paramSetRegistryValue)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-LogEntry -Value "Value for 'BitLockerEscrowResults' was '$($BitLockerEscrowResultsValue)', will not attempt to backup recovery password once more" -Severity 1
|
||||
|
||||
try
|
||||
{
|
||||
# Disable scheduled task
|
||||
$paramGetScheduledTask = @{
|
||||
TaskName = 'Backup BitLocker Recovery Password to Azure AD'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$ScheduledTask = (Get-ScheduledTask @paramGetScheduledTask)
|
||||
|
||||
$paramDisableScheduledTask = @{
|
||||
InputObject = $ScheduledTask
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Disable-ScheduledTask @paramDisableScheduledTask)
|
||||
|
||||
Write-LogEntry -Value "Successfully disabled scheduled task named 'Backup BitLocker Recovery Password to Azure AD'" -Severity 1
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "An error occurred while disabling scheduled task to backup recovery password. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-LogEntry -Value "An error occurred while reading 'BitLockerEscrowResults' registry value. Error message: $($_.Exception.Message)" -Severity 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Enable DNS-over-HTTPS (DoH) if device is not domain-joined
|
||||
|
||||
.DESCRIPTION
|
||||
Enable DNS-over-HTTPS (DoH) if device is not domain-joined
|
||||
|
||||
It enables the Cloudflare DNS Servers, even if DoH is not working yet.
|
||||
|
||||
IPv6 Support is optional.
|
||||
|
||||
.PARAMETER IPv6
|
||||
Enable IPv6 Support, IPv6 Servers will be added to the server list
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Enable-DNSOverHTTPS.ps1
|
||||
|
||||
Enable DNS-over-HTTPS (DoH) if device is not domain-joined for IPv4 only
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Enable-DNSOverHTTPS.ps1 -IPv6
|
||||
|
||||
Enable DNS-over-HTTPS (DoH) if device is not domain-joined for IPv4 and IPv6
|
||||
|
||||
.NOTES
|
||||
Only the Insider Build of Windows 10 supports DoH!
|
||||
But we configure it anyway!
|
||||
|
||||
The Cloudflare servers are used for regular DNS resolution and as soon as DoH is supported,
|
||||
we can configure and use it anyway.
|
||||
|
||||
A future version of this script might support additional parameters, like DohFlags
|
||||
|
||||
You can also change the servers below to any service you like, e.g. Google DNS or Quad9 from IBM.
|
||||
|
||||
The Bool as return was requested by a customer, and the exit code (0 or 1) is implemented for our bootstrap setup
|
||||
|
||||
.LINK
|
||||
https://1.1.1.1/dns/
|
||||
|
||||
.LINK
|
||||
https://techcommunity.microsoft.com/t5/networking-blog/windows-insiders-can-now-test-dns-over-https/ba-p/1381282
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'None')]
|
||||
[OutputType([bool])]
|
||||
param
|
||||
(
|
||||
[Parameter(ValueFromPipeline,
|
||||
ValueFromPipelineByPropertyName)]
|
||||
[Alias('IP6', '6')]
|
||||
[switch]
|
||||
$IPv6
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
$STP = 'Stop'
|
||||
$CNT = 'Continue'
|
||||
|
||||
# Save the infos from the switches
|
||||
if (($PSCmdlet.MyInvocation.BoundParameters['Verbose']).IsPresent)
|
||||
{
|
||||
$IsVerbose = $true
|
||||
}
|
||||
else
|
||||
{
|
||||
$IsVerbose = $false
|
||||
}
|
||||
|
||||
if (($PSCmdlet.MyInvocation.BoundParameters['Debug']).IsPresent)
|
||||
{
|
||||
$IsDebug = $true
|
||||
}
|
||||
else
|
||||
{
|
||||
$IsDebug = $false
|
||||
}
|
||||
|
||||
if (($PSCmdlet.MyInvocation.BoundParameters['WhatIf']).IsPresent)
|
||||
{
|
||||
$IsWhatIf = $true
|
||||
}
|
||||
else
|
||||
{
|
||||
$IsWhatIf = $false
|
||||
}
|
||||
#endregion Defaults
|
||||
|
||||
#region ServerAddresses
|
||||
# Create an Empty Object
|
||||
$ServerAddresses = @()
|
||||
|
||||
# IPv4 DNS Servers to use
|
||||
$ServerAddressesIPv4 = @(
|
||||
'1.1.1.1'
|
||||
'1.0.0.1'
|
||||
)
|
||||
|
||||
# Add the IPv4 Servers to the Object
|
||||
$ServerAddresses += $ServerAddressesIPv4
|
||||
|
||||
if ((($PSCmdlet.MyInvocation.BoundParameters['IPv6']).IsPresent) -eq $true)
|
||||
{
|
||||
Write-Verbose -Message 'IPv6 Servers will be added to the serverlist'
|
||||
# IPv6 DNS Servers to use
|
||||
$ServerAddressesIPv6 = @(
|
||||
'2606:4700:4700::1111'
|
||||
'2606:4700:4700::1001'
|
||||
)
|
||||
|
||||
# Add the IPv6 Servers to the Object
|
||||
$ServerAddresses += $ServerAddressesIPv6
|
||||
}
|
||||
#endregion ServerAddresses
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
#region DoH
|
||||
# Enable DNS-over-HTTPS for IPv4 if device is not domain-joined
|
||||
$paramGetCimInstance = @{
|
||||
ClassName = 'CIM_ComputerSystem'
|
||||
Verbose = $IsVerbose
|
||||
Debug = $IsDebug
|
||||
ErrorAction = $STP
|
||||
}
|
||||
if (((Get-CimInstance @paramGetCimInstance).PartOfDomain) -eq $false)
|
||||
{
|
||||
try
|
||||
{
|
||||
# Temporarily key
|
||||
$paramNewItemProperty = @{
|
||||
Path = 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters'
|
||||
Name = 'EnableAutoDoh'
|
||||
Value = 2
|
||||
PropertyType = 'DWord'
|
||||
Force = $true
|
||||
WhatIf = $IsWhatIf
|
||||
Verbose = $IsVerbose
|
||||
Debug = $IsDebug
|
||||
ErrorAction = $CNT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
|
||||
$paramGetNetAdapter = @{
|
||||
Verbose = $IsVerbose
|
||||
Debug = $IsDebug
|
||||
Physical = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$MACAddress = ((Get-NetAdapter @paramGetNetAdapter).MacAddress)
|
||||
|
||||
$paramGetNetIPConfiguration = @{
|
||||
Verbose = $IsVerbose
|
||||
Debug = $IsDebug
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$IpConfig = (Get-NetIPConfiguration @paramGetNetIPConfiguration | Where-Object -FilterScript {
|
||||
$MACAddress -eq $_.NetAdapter.MacAddress
|
||||
})
|
||||
|
||||
$paramSetDnsClientServerAddress = @{
|
||||
ServerAddresses = $ServerAddresses
|
||||
Verbose = $IsVerbose
|
||||
Debug = $IsDebug
|
||||
ErrorAction = $CNT
|
||||
}
|
||||
$null = ($IpConfig | Set-DnsClientServerAddress @paramSetDnsClientServerAddress)
|
||||
|
||||
$paramClearDnsClientCache = @{
|
||||
Verbose = $IsVerbose
|
||||
Debug = $IsDebug
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Clear-DnsClientCache @paramClearDnsClientCache)
|
||||
|
||||
$paramRegisterDnsClient = @{
|
||||
Verbose = $IsVerbose
|
||||
Debug = $IsDebug
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Register-DnsClient @paramRegisterDnsClient)
|
||||
}
|
||||
catch
|
||||
{
|
||||
# Get error record
|
||||
[Management.Automation.ErrorRecord]$e = $_
|
||||
|
||||
# retrieve information about runtime error
|
||||
$info = [PSCustomObject]@{
|
||||
Exception = $e.Exception.Message
|
||||
Reason = $e.CategoryInfo.Reason
|
||||
Target = $e.CategoryInfo.TargetName
|
||||
Script = $e.InvocationInfo.ScriptName
|
||||
Line = $e.InvocationInfo.ScriptLineNumber
|
||||
Column = $e.InvocationInfo.OffsetInLine
|
||||
}
|
||||
|
||||
# output information. Post-process collected info, and log info (optional)
|
||||
$info | Out-String | Write-Verbose
|
||||
|
||||
$paramWriteError = @{
|
||||
Message = $e.Exception.Message
|
||||
ErrorAction = $CNT
|
||||
Exception = $e.Exception
|
||||
TargetObject = $e.CategoryInfo.TargetName
|
||||
}
|
||||
Write-Error @paramWriteError
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$paramWriteError = @{
|
||||
Message = 'Sorry, this computer seems to be part of a Active Directory domain!'
|
||||
Exception = 'Active Directory Domain Members are not supported'
|
||||
Category = 'NotEnabled'
|
||||
TargetObject = $env:COMPUTERNAME
|
||||
ErrorAction = $CNT
|
||||
}
|
||||
Write-Error @paramWriteError
|
||||
|
||||
# Return the Bool
|
||||
Write-Output -InputObject $false
|
||||
|
||||
# Unclean exit
|
||||
exit 1
|
||||
}
|
||||
#endregion DoH
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
# Return the Bool
|
||||
Write-Output -InputObject $true
|
||||
|
||||
# Clean exit
|
||||
exit 0
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,111 @@
|
||||
#requires -Version 1.0
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Configure and enhance Endpoint Manager (Intune) Agent logging
|
||||
|
||||
.DESCRIPTION
|
||||
Configure and enhance Endpoint Manager (Intune) Agent logging
|
||||
|
||||
.NOTES
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Configure and enhance Endpont Manager (Intune) Agent logging'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
#region Variables
|
||||
# Cleanup
|
||||
$logMaxSize = $null
|
||||
|
||||
# Size in MB
|
||||
$logMaxSize = 4
|
||||
|
||||
# Logic From MB to Bytes
|
||||
$logMaxSize = ($logMaxSize * 1024 * 1024)
|
||||
|
||||
# Define log files to keep
|
||||
$logMaxHistory = 4
|
||||
|
||||
# Main Registry Path
|
||||
$regKeyFullPath = 'HKLM:\SOFTWARE\Microsoft\IntuneWindowsAgent\Logging'
|
||||
#endregion Variables
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Create the registry key path for the Endpont Manager (Intune) agent
|
||||
$paramNewItem = @{
|
||||
Path = $regKeyFullPath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
|
||||
# Set value to define new size instead of the default 2 MB
|
||||
$paramSetItemProperty = @{
|
||||
Path = $regKeyFullPath
|
||||
Name = 'LogMaxSize'
|
||||
Value = $logMaxSize
|
||||
Type = 'String'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Set-ItemProperty @paramSetItemProperty)
|
||||
|
||||
# Set value to define new amount of logfiles to keep
|
||||
$paramSetItemProperty = @{
|
||||
Path = $regKeyFullPath
|
||||
Name = 'LogMaxHistory'
|
||||
Value = $logMaxHistory
|
||||
Type = 'String'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Set-ItemProperty @paramSetItemProperty)
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,146 @@
|
||||
#requires -Version 2.0
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Get information from the local computer such as Azure AD join status, tenant Id, device id
|
||||
|
||||
.DESCRIPTION
|
||||
Get information from the local computer such as Azure AD join status, tenant Id, device id and such. Similar information as dsregcmd /status
|
||||
|
||||
.EXAMPLE
|
||||
.\Get-AadJoinInformation.ps1
|
||||
|
||||
.NOTES
|
||||
Version 1.0.1
|
||||
|
||||
Based on Get-AadJoinInformation.ps1 1.0 from Mattias Fors (DeployWindows.com)
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'None')]
|
||||
[OutputType([int])]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
$SCT = 'SilentlyContinue'
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
$null = (Add-Type -TypeDefinition @'
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class NetAPI32{
|
||||
public enum DSREG_JOIN_TYPE {
|
||||
DSREG_UNKNOWN_JOIN,
|
||||
DSREG_DEVICE_JOIN,
|
||||
DSREG_WORKPLACE_JOIN
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
|
||||
public struct DSREG_USER_INFO {
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string UserEmail;
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string UserKeyId;
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string UserKeyName;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
|
||||
public struct CERT_CONTEX {
|
||||
public uint dwCertEncodingType;
|
||||
public byte pbCertEncoded;
|
||||
public uint cbCertEncoded;
|
||||
public IntPtr pCertInfo;
|
||||
public IntPtr hCertStore;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
|
||||
public struct DSREG_JOIN_INFO
|
||||
{
|
||||
public int joinType;
|
||||
public IntPtr pJoinCertificate;
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string DeviceId;
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string IdpDomain;
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string TenantId;
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string JoinUserEmail;
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string TenantDisplayName;
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string MdmEnrollmentUrl;
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string MdmTermsOfUseUrl;
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string MdmComplianceUrl;
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string UserSettingSyncUrl;
|
||||
public IntPtr pUserInfo;
|
||||
}
|
||||
|
||||
[DllImport("netapi32.dll", CharSet=CharSet.Unicode, SetLastError=true)]
|
||||
public static extern void NetFreeAadJoinInformation(
|
||||
IntPtr pJoinInfo);
|
||||
|
||||
[DllImport("netapi32.dll", CharSet=CharSet.Unicode, SetLastError=true)]
|
||||
public static extern int NetGetAadJoinInformation(
|
||||
string pcszTenantId,
|
||||
out IntPtr ppJoinInfo);
|
||||
}
|
||||
'@ -ErrorAction $SCT)
|
||||
|
||||
$pcszTenantId = $null
|
||||
$ptrJoinInfo = [IntPtr]::Zero
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# https://docs.microsoft.com/en-us/windows/win32/api/lmjoin/nf-lmjoin-netgetaadjoininformation
|
||||
[NetAPI32]::NetFreeAadJoinInformation([IntPtr]::Zero)
|
||||
$retValue = [NetAPI32]::NetGetAadJoinInformation($pcszTenantId, [ref]$ptrJoinInfo)
|
||||
|
||||
# https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d
|
||||
if ($retValue -eq 0)
|
||||
{
|
||||
# https://support.microsoft.com/en-us/help/2909958/exceptions-in-windows-powershell-other-dynamic-languages-and-dynamical
|
||||
|
||||
$paramNewObject = @{
|
||||
TypeName = 'NetAPI32+DSREG_JOIN_INFO'
|
||||
}
|
||||
$ptrJoinInfoObject = (New-Object @paramNewObject)
|
||||
$joinInfo = ([Runtime.InteropServices.Marshal]::PtrToStructure($ptrJoinInfo, [type]$ptrJoinInfoObject.GetType()) | Select-Object -ExpandProperty joinType)
|
||||
|
||||
switch ($joinInfo)
|
||||
{
|
||||
([NetAPI32+DSREG_JOIN_TYPE]::DSREG_DEVICE_JOIN.value__)
|
||||
{
|
||||
Write-Verbose -Message 'Device is joined'
|
||||
|
||||
[int]$JoinType = 1
|
||||
}
|
||||
([NetAPI32+DSREG_JOIN_TYPE]::DSREG_UNKNOWN_JOIN.value__)
|
||||
{
|
||||
Write-Verbose -Message 'Device is not joined, or unknown type'
|
||||
[int]$JoinType = 0
|
||||
}
|
||||
([NetAPI32+DSREG_JOIN_TYPE]::DSREG_WORKPLACE_JOIN.value__)
|
||||
{
|
||||
Write-Verbose -Message 'Device workplace joined'
|
||||
|
||||
[int]$JoinType = 2
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose -Message 'Not Azure Joined'
|
||||
|
||||
[int]$JoinType = 0
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
$JoinType
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
#requires -Version 3.0 -Modules PSWindowsUpdate -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Install all missing Microsoft updated
|
||||
|
||||
.DESCRIPTION
|
||||
Install all missing Microsoft updated using the PSWindowsUpdate module
|
||||
|
||||
.NOTES
|
||||
Version 1.0.3
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Install all missing Microsoft updated'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
#region HelperFunctions
|
||||
function Test-GetWUServiceManager
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Check if WUServiceManager is configured
|
||||
|
||||
.DESCRIPTION
|
||||
Check if WUServiceManager is configured
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Test-GetWUServiceManager
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'None',
|
||||
SupportsShouldProcess)]
|
||||
[OutputType([bool])]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
$ServiceID = '7971f918-a847-4430-9279-4a52d1efe18d'
|
||||
#endregion Defaults
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
$paramGetWUServiceManager = @{
|
||||
ComputerName = $env:COMPUTERNAME
|
||||
ServiceID = $ServiceID
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$WUServiceManager = (Get-WUServiceManager @paramGetWUServiceManager)
|
||||
|
||||
if (-not ($WUServiceManager))
|
||||
{
|
||||
$paramAddWUServiceManager = @{
|
||||
ComputerName = $env:COMPUTERNAME
|
||||
ServiceID = $ServiceID
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Add-WUServiceManager @paramAddWUServiceManager)
|
||||
|
||||
return $false
|
||||
}
|
||||
else
|
||||
{
|
||||
return $true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-GetWindowsUpdate
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Wrapper for Get-WindowsUpdate
|
||||
|
||||
.DESCRIPTION
|
||||
Wrapper for Get-WindowsUpdate
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Invoke-GetWindowsUpdate
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
$paramGetWindowsUpdate = @{
|
||||
ComputerName = $env:COMPUTERNAME
|
||||
MicrosoftUpdate = $true
|
||||
Install = $true
|
||||
ForceInstall = $true
|
||||
IgnoreUserInput = $true
|
||||
AcceptAll = $true
|
||||
AutoReboot = $false
|
||||
IgnoreReboot = $true
|
||||
Criteria = "IsHidden=0 and IsInstalled=0 and Type='Software'"
|
||||
WhatIf = $false
|
||||
Verbose = $true
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
$null = (Get-WindowsUpdate @paramGetWindowsUpdate)
|
||||
}
|
||||
}
|
||||
#endregion HelperFunctions
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
if (Test-GetWUServiceManager -ErrorAction $SCT)
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
$null = (Invoke-GetWindowsUpdate -ErrorAction $SCT)
|
||||
}
|
||||
else
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
# Retry to fix it
|
||||
$null = (Test-GetWUServiceManager -ErrorAction $SCT)
|
||||
|
||||
$Retry = $true
|
||||
}
|
||||
|
||||
if ($Retry -eq $true)
|
||||
{
|
||||
if (Test-GetWUServiceManager -ErrorAction $SCT)
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
$null = (Invoke-GetWindowsUpdate -ErrorAction $SCT)
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Warning -Message 'Unable to apply the latest Microsoft updates, please check and apply them manually!' -WarningAction Stop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,186 @@
|
||||
#requires -Version 2.0 -Modules PackageManagement, PowerShellGet -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Check and install all prerequisites and dependencies, if they are needed
|
||||
|
||||
.DESCRIPTION
|
||||
Check and install all prerequisites and dependencies, if they are needed
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Install-AutoPilotRelated.ps1
|
||||
|
||||
# Check and install all prerequisites and dependencies, if they are needed
|
||||
|
||||
.NOTES
|
||||
Version 1.0.1
|
||||
|
||||
Additional information about the file.
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'None')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
#region Global
|
||||
$IGN = 'Ignore'
|
||||
$SCT = 'SilentlyContinue'
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
$paramFindPackageProvider = @{
|
||||
Name = 'NuGet'
|
||||
ForceBootstrap = $true
|
||||
IncludeDependencies = $true
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
|
||||
$paramInstallModule = @{
|
||||
Force = $true
|
||||
Scope = 'AllUsers'
|
||||
AllowClobber = $true
|
||||
SkipPublisherCheck = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
|
||||
$paramSetPSRepository = @{
|
||||
Name = 'PSGallery'
|
||||
InstallationPolicy = 'Trusted'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
|
||||
$paramInstallScript = @{
|
||||
Name = 'Get-WindowsAutoPilotInfo'
|
||||
Scope = 'AllUsers'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
#endregion Global
|
||||
|
||||
#region Cleanup
|
||||
$NuGetProvider = $null
|
||||
$WindowsAutopilotIntuneModule = $null
|
||||
$AzureADModule = $null
|
||||
$ScriptInfo = $null
|
||||
#endregion Cleanup
|
||||
|
||||
#region GatherInfo
|
||||
$paramGetPackageProvider = @{
|
||||
Name = 'NuGet'
|
||||
ErrorAction = $IGN
|
||||
}
|
||||
$NuGetProvider = (Get-PackageProvider @paramGetPackageProvider)
|
||||
|
||||
$paramImportModule = @{
|
||||
NoClobber = $true
|
||||
DisableNameChecking = $true
|
||||
PassThru = $true
|
||||
ErrorAction = $IGN
|
||||
}
|
||||
|
||||
# Get the module info
|
||||
$WindowsAutopilotIntuneModule = (Import-Module -Name WindowsAutopilotIntune @paramImportModule)
|
||||
$AzureADModule = (Import-Module -Name AzureAD @paramImportModule)
|
||||
|
||||
# Get the repository info
|
||||
$PSRepositoryInfo = (Get-PSRepository -Name PSGallery -ErrorAction $SCT)
|
||||
#endregion GatherInfo
|
||||
|
||||
#region
|
||||
$paramGetInstalledScript = @{
|
||||
Name = 'Get-WindowsAutoPilotInfo'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$ScriptInfo = (Get-InstalledScript @paramGetInstalledScript)
|
||||
#endregion
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
#region PackageProvider
|
||||
# Get the NuGet PackageProvider for the PowerShell Gallery, if needed
|
||||
if (-not $NuGetProvider)
|
||||
{
|
||||
$null = (Find-PackageProvider @paramFindPackageProvider)
|
||||
}
|
||||
#endregion PackageProvider
|
||||
|
||||
#region PSRepository
|
||||
if (($PSRepositoryInfo | Select-Object -ExpandProperty InstallationPolicy) -ne $true)
|
||||
{
|
||||
$null = (Set-PSRepository @paramSetPSRepository)
|
||||
}
|
||||
#endregion PSRepository
|
||||
|
||||
#region ModuleHandler
|
||||
# Get Azure AD module, if needed
|
||||
if (-not $AzureADModule)
|
||||
{
|
||||
$null = (Install-Module -Name AzureAD @paramInstallModule)
|
||||
}
|
||||
|
||||
# Get WindowsAutopilotIntune module, if needed
|
||||
if (-not $WindowsAutopilotIntuneModule)
|
||||
{
|
||||
$null = (Install-Module -Name WindowsAutopilotIntune @paramInstallModule)
|
||||
}
|
||||
#endregion ModuleHandler
|
||||
|
||||
#region ScriptHandler
|
||||
# Install the Helper script from the Gallery
|
||||
if (-not $ScriptInfo)
|
||||
{
|
||||
$null = (Install-Script @paramInstallScript)
|
||||
}
|
||||
#endregion ScriptHandler
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
#region Cleanup
|
||||
$NuGetProvider = $null
|
||||
$WindowsAutopilotIntuneModule = $null
|
||||
$AzureADModule = $null
|
||||
$ScriptInfo = $null
|
||||
#endregion Cleanup
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,232 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Download and install the chocolatey default base packages
|
||||
|
||||
.DESCRIPTION
|
||||
Download and install the chocolatey default base packages
|
||||
|
||||
.NOTES
|
||||
These are the chocolatey default packages, that we want to have on all new systems
|
||||
|
||||
Changelog:
|
||||
1.3.7: Removed vscode-powershell
|
||||
1.3.6: Add 'FiraCode-ttf' (Requested) and removed 'notepadplusplus' (Replaced by VSCode)
|
||||
1.3.4: Reformatted
|
||||
1.3.3: Removed Chromium Edge (Now part of Windows 10)
|
||||
|
||||
Version 1.3.7
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
|
||||
.LINK
|
||||
https://chocolatey.org/docs
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Download and install the chocolatey default base packages'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
#region
|
||||
if (-not $env:ChocolateyInstall)
|
||||
{
|
||||
$env:ChocolateyInstall = 'C:\ProgramData\chocolatey'
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ChocoCacheLocation
|
||||
$ChocoCacheLocation = "$env:HOMEDRIVE\temp\choco\"
|
||||
$paramTestPath = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ErrorAction = $SCT
|
||||
WarningAction = '-'
|
||||
Filter = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ItemType = 'directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = '-'
|
||||
Value = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
#endregion ChocoCacheLocation
|
||||
|
||||
#region
|
||||
$paramGetCommand = @{
|
||||
Name = 'Update-SessionEnvironment'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramTestPath = @{
|
||||
Path = "$env:ChocolateyInstall\bin\refreshenv.cmd"
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Get-Command @paramGetCommand)
|
||||
{
|
||||
$null = (Update-SessionEnvironment -WarningAction $SCT -ErrorAction $SCT)
|
||||
}
|
||||
elseif (Test-Path @paramTestPath)
|
||||
{
|
||||
$null = (& "$env:ChocolateyInstall\bin\refreshenv.cmd")
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$null = ([Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 3072)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Verbose -Message 'Unable to set PowerShell to use TLS 1.2.'
|
||||
}
|
||||
|
||||
# Use Windows built-in compression instead of downloading 7zip
|
||||
$env:chocolateyUseWindowsCompression = 'true'
|
||||
|
||||
$AllChocoPackages = @(
|
||||
'BGInfo'
|
||||
'chocolatey-core.extension'
|
||||
'chocolatey-dotnetfx.extension'
|
||||
'chocolatey-misc-helpers.extension'
|
||||
'chocolatey-windowsupdate.extension'
|
||||
'chocolatey-font-helpers.extension'
|
||||
'chocolatey-vscode.extension'
|
||||
'chocolatey-vscode'
|
||||
'FiraCode'
|
||||
'FiraCode-ttf'
|
||||
'Cascadia'
|
||||
'CascadiaMono'
|
||||
'CascadiaMonoPL'
|
||||
'microsoft-edge'
|
||||
'nuget.commandline'
|
||||
'nxlog'
|
||||
'powershell-core'
|
||||
'vscode'
|
||||
)
|
||||
|
||||
# Initial Package Counter
|
||||
$PackageCounter = 1
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($ChocoPackage in $AllChocoPackages)
|
||||
{
|
||||
try
|
||||
{
|
||||
Write-Verbose -Message ('Start the installation of ' + $ChocoPackage)
|
||||
|
||||
if ($pscmdlet.ShouldProcess($ChocoPackage, 'Install'))
|
||||
{
|
||||
Write-Progress -Activity ('Installing ' + $ChocoPackage) -Status ('Package ' + $PackageCounter + ' of ' + $($AllChocoPackages.Count)) -PercentComplete (($PackageCounter / $AllChocoPackages.Count) * 100)
|
||||
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" install $ChocoPackage --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1')
|
||||
}
|
||||
catch
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
# Retry with --ignore-checksums - A less secure option!!!
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" install $ChocoPackage --ignore-checksums --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1')
|
||||
# Some Packages (e.g. Sysmon) use the latest and greatest version, the checksum check will cause issues in this case!
|
||||
}
|
||||
}
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ('Installation of ' + $ChocoPackage + ' failed!')
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,211 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Download and install the chocolatey default base packages
|
||||
|
||||
.DESCRIPTION
|
||||
Download and install the chocolatey default base packages
|
||||
|
||||
.NOTES
|
||||
These are the chocolatey default packages, that we want to have on all new systems
|
||||
|
||||
Changelog:
|
||||
1.4.0: Switched from 'Install' to 'upgrade' as Choco command (More flexible and robust)
|
||||
1.3.9: Add Cache Location to all Choco commands and makle sure it exist
|
||||
1.3.7: Removed vscode-powershell
|
||||
1.3.6: Add 'FiraCode-ttf' (Requested) and removed 'notepadplusplus' (Replaced by VSCode)
|
||||
1.3.4: Reformatted
|
||||
1.3.3: Removed Chromium Edge (Now part of Windows 10)
|
||||
|
||||
Version 1.4.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
|
||||
.LINK
|
||||
https://chocolatey.org/docs
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Download and install the chocolatey default base packages'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
#region
|
||||
if (-not $env:ChocolateyInstall)
|
||||
{
|
||||
$env:ChocolateyInstall = 'C:\ProgramData\chocolatey'
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region
|
||||
$paramGetCommand = @{
|
||||
Name = 'Update-SessionEnvironment'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramTestPath = @{
|
||||
Path = "$env:ChocolateyInstall\bin\refreshenv.cmd"
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Get-Command @paramGetCommand)
|
||||
{
|
||||
$null = (Update-SessionEnvironment -WarningAction $SCT -ErrorAction $SCT)
|
||||
}
|
||||
elseif (Test-Path @paramTestPath)
|
||||
{
|
||||
$null = (& "$env:ChocolateyInstall\bin\refreshenv.cmd")
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$null = ([Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 3072)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Verbose -Message 'Unable to set PowerShell to use TLS 1.2.'
|
||||
}
|
||||
|
||||
# Use Windows built-in compression instead of downloading 7zip
|
||||
$env:chocolateyUseWindowsCompression = 'true'
|
||||
|
||||
$AllChocoPackages = @(
|
||||
'BGInfo'
|
||||
'chocolatey-core.extension'
|
||||
'chocolatey-dotnetfx.extension'
|
||||
'chocolatey-misc-helpers.extension'
|
||||
'chocolatey-windowsupdate.extension'
|
||||
'chocolatey-font-helpers.extension'
|
||||
'chocolatey-vscode.extension'
|
||||
'chocolatey-vscode'
|
||||
'FiraCode'
|
||||
'FiraCode-ttf'
|
||||
'Cascadia'
|
||||
'CascadiaMono'
|
||||
'CascadiaMonoPL'
|
||||
'microsoft-edge'
|
||||
'nuget.commandline'
|
||||
'nxlog'
|
||||
'powershell-core'
|
||||
'vscode'
|
||||
)
|
||||
|
||||
# Initial Package Counter
|
||||
$PackageCounter = 1
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($ChocoPackage in $AllChocoPackages)
|
||||
{
|
||||
try
|
||||
{
|
||||
Write-Verbose -Message ('Start the installation of ' + $ChocoPackage)
|
||||
|
||||
if ($pscmdlet.ShouldProcess($ChocoPackage, 'Install'))
|
||||
{
|
||||
Write-Progress -Activity ('Installing ' + $ChocoPackage) -Status ('Package ' + $PackageCounter + ' of ' + $($AllChocoPackages.Count)) -PercentComplete (($PackageCounter / $AllChocoPackages.Count) * 100)
|
||||
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" install $ChocoPackage --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1')
|
||||
}
|
||||
catch
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
# Retry with --ignore-checksums - A less secure option!!!
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" install $ChocoPackage --ignore-checksums --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1')
|
||||
# Some Packages (e.g. Sysmon) use the latest and greatest version, the checksum check will cause issues in this case!
|
||||
}
|
||||
}
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ('Installation of ' + $ChocoPackage + ' failed!')
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,221 @@
|
||||
#requires -Version 3.0
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Download and install the chocolatey default packages for the user context
|
||||
|
||||
.DESCRIPTION
|
||||
Download and install the chocolatey default packages for the user context
|
||||
|
||||
.NOTES
|
||||
All chocolatey in this file will be installed into: C:\Users\<UserName>\AppData\Local\chocoportable
|
||||
|
||||
Changelog:
|
||||
1.0.0: Switched from 'Install' to 'upgrade' as Choco command (More flexible and robust)
|
||||
0.0.10: Add Cache Location to all Choco commands and make sure it exist
|
||||
0.0.9: Initial Test version
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
|
||||
.LINK
|
||||
https://chocolatey.org/docs
|
||||
|
||||
.LINK
|
||||
https://chocolatey.org/docs/installation#non-administrative-install
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Download and install the chocolatey default packages for Workstations'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
#region SetExecutionPolicy
|
||||
$null = (Set-ExecutionPolicy -Scope CurrentUser Bypass -Force -ErrorAction $SCT)
|
||||
$null = (Set-ExecutionPolicy -Scope Process Bypass -Force -ErrorAction $SCT)
|
||||
#endregion SetExecutionPolicy
|
||||
|
||||
#region ChocolateyInstallPath
|
||||
# Use the User Profile
|
||||
$env:ChocolateyInstall = ($env:LOCALAPPDATA + '\chocoportable')
|
||||
#endregion ChocolateyInstallPath
|
||||
|
||||
#region ChocoCacheLocation
|
||||
$ChocoCacheLocation = "$env:HOMEDRIVE\temp\choco\"
|
||||
$paramTestPath = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ItemType = 'directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
#endregion ChocoCacheLocation
|
||||
|
||||
#region
|
||||
$paramGetCommand = @{
|
||||
Name = 'Update-SessionEnvironment'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramTestPath = @{
|
||||
Path = "$env:ChocolateyInstall\bin\refreshenv.cmd"
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Get-Command @paramGetCommand)
|
||||
{
|
||||
$paramUpdateSessionEnvironment = @{
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Update-SessionEnvironment @paramUpdateSessionEnvironment)
|
||||
}
|
||||
elseif (Test-Path @paramTestPath)
|
||||
{
|
||||
$null = (& "$env:ChocolateyInstall\bin\refreshenv.cmd")
|
||||
}
|
||||
#endregion
|
||||
|
||||
try
|
||||
{
|
||||
$null = ([Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 3072)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Verbose -Message 'Unable to set PowerShell to use TLS 1.2.'
|
||||
}
|
||||
|
||||
# Use Windows built-in compression instead of downloading 7zip
|
||||
$env:chocolateyUseWindowsCompression = 'true'
|
||||
|
||||
$AllChocoPackages = @(
|
||||
'1password'
|
||||
'op'
|
||||
'auto-dark-mode'
|
||||
'microsoft-windows-terminal'
|
||||
)
|
||||
|
||||
# Initial Package Counter
|
||||
$PackageCounter = 1
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($ChocoPackage in $AllChocoPackages)
|
||||
{
|
||||
try
|
||||
{
|
||||
Write-Verbose -Message ('Start the installation of ' + $ChocoPackage)
|
||||
|
||||
if ($pscmdlet.ShouldProcess($ChocoPackage, 'Install'))
|
||||
{
|
||||
Write-Progress -Activity ('Installing ' + $ChocoPackage) -Status ('Package ' + $PackageCounter + ' of ' + $($AllChocoPackages.Count)) -PercentComplete (($PackageCounter / $AllChocoPackages.Count) * 100)
|
||||
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
# This should install everything into the User Profile - The first installation will take longer then normal
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" upgrade $ChocoPackage --allowemptychecksum --ignore-checksums --ignore-dependencies --ignoredetectedreboot --no-progress --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=0' --cacheLocation=$ChocoCacheLocation)
|
||||
}
|
||||
catch
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
# Retry with --ignore-checksums - A less secure option!!!
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" upgrade $ChocoPackage --allowemptychecksum --ignore-checksums --ignoredetectedreboot --no-progress --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1' --cacheLocation=$ChocoCacheLocation)
|
||||
# Some Packages (e.g. Sysmon) use the latest and greatest version, the checksum check will cause issues in this case!
|
||||
}
|
||||
}
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ('Installation of ' + $ChocoPackage + ' failed!')
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,250 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Download and install the chocolatey default packages for Workstations
|
||||
|
||||
.DESCRIPTION
|
||||
Download and install the chocolatey default packages for Workstations
|
||||
|
||||
.NOTES
|
||||
These are the chocolatey default packages, that we want to have on all new systems
|
||||
|
||||
Changelog:
|
||||
1.2.0: Switched from 'Install' to 'upgrade' as Choco command (More flexible and robust)
|
||||
1.1.11: Add Cache Location to all Choco commands and makle sure it exist
|
||||
1.1.10: Add Git Fork Client
|
||||
1.1.9: Add 'choco-cleaner'
|
||||
1.1.8: Removed Python (Now a DEV package)
|
||||
1.1.7: Fix some issues and add some 'Install' packages
|
||||
1.1.6: Reformatted
|
||||
1.1.5: Removed "Firefox", "Chrome", and "graphviz" - All moved to the Developer package selection
|
||||
|
||||
Version 1.2.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
|
||||
.LINK
|
||||
https://chocolatey.org/docs
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Download and install the chocolatey default packages for Workstations'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
#region
|
||||
if (-not $env:ChocolateyInstall)
|
||||
{
|
||||
$env:ChocolateyInstall = 'C:\ProgramData\chocolatey'
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ChocoCacheLocation
|
||||
$ChocoCacheLocation = "$env:HOMEDRIVE\temp\choco\"
|
||||
$paramTestPath = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ItemType = 'directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
#endregion ChocoCacheLocation
|
||||
|
||||
#region
|
||||
$paramGetCommand = @{
|
||||
Name = 'Update-SessionEnvironment'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramTestPath = @{
|
||||
Path = "$env:ChocolateyInstall\bin\refreshenv.cmd"
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Get-Command @paramGetCommand)
|
||||
{
|
||||
$paramUpdateSessionEnvironment = @{
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Update-SessionEnvironment @paramUpdateSessionEnvironment)
|
||||
}
|
||||
elseif (Test-Path @paramTestPath)
|
||||
{
|
||||
$null = (& "$env:ChocolateyInstall\bin\refreshenv.cmd")
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$null = ([Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 3072)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Verbose -Message 'Unable to set PowerShell to use TLS 1.2.'
|
||||
}
|
||||
|
||||
# Use Windows built-in compression instead of downloading 7zip
|
||||
$env:chocolateyUseWindowsCompression = 'true'
|
||||
|
||||
$AllChocoPackages = @(
|
||||
'1password' # Used to get dependencies
|
||||
'op' # Used to get dependencies
|
||||
'auto-dark-mode' # Used to get dependencies
|
||||
'microsoft-windows-terminal' # Used to get dependencies
|
||||
'choco-cleaner'
|
||||
'cyberduck.install'
|
||||
'chocolateygui'
|
||||
'curl'
|
||||
'displaylink'
|
||||
'git.install'
|
||||
'git-credential-manager-for-windows'
|
||||
'git-credential-winstore'
|
||||
'keepass.install'
|
||||
'keepassxc'
|
||||
'keepass-plugin-1p2kp'
|
||||
'keepass-plugin-qrcodegen'
|
||||
'keepass-plugin-rdp'
|
||||
'keepass-plugin-keeotp'
|
||||
'keepass-plugin-keechallenge'
|
||||
'makemeadmin'
|
||||
'marktext.install'
|
||||
'paint.net'
|
||||
'powertoys'
|
||||
'putty.install'
|
||||
'vlc'
|
||||
'winscp.install'
|
||||
'yubikey-manager'
|
||||
'yubikey-personalization-tool'
|
||||
'yubikey-piv-manager'
|
||||
'yubico-authenticator'
|
||||
)
|
||||
|
||||
# Initial Package Counter
|
||||
$PackageCounter = 1
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($ChocoPackage in $AllChocoPackages)
|
||||
{
|
||||
try
|
||||
{
|
||||
Write-Verbose -Message ('Start the installation of ' + $ChocoPackage)
|
||||
|
||||
if ($pscmdlet.ShouldProcess($ChocoPackage, 'Install'))
|
||||
{
|
||||
Write-Progress -Activity ('Installing ' + $ChocoPackage) -Status ('Package ' + $PackageCounter + ' of ' + $($AllChocoPackages.Count)) -PercentComplete (($PackageCounter / $AllChocoPackages.Count) * 100)
|
||||
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" upgrade $ChocoPackage --ignoredetectedreboot --no-progress --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1' --cacheLocation=$ChocoCacheLocation)
|
||||
}
|
||||
catch
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
# Retry with --ignore-checksums - A less secure option!!!
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" upgrade $ChocoPackage --allowemptychecksum --ignore-checksums --ignoredetectedreboot --no-progress --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1' --cacheLocation=$ChocoCacheLocation)
|
||||
# Some Packages (e.g. Sysmon) use the latest and greatest version, the checksum check will cause issues in this case!
|
||||
}
|
||||
}
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ('Installation of ' + $ChocoPackage + ' failed!')
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,240 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Download and install the chocolatey default packages for Workstations
|
||||
|
||||
.DESCRIPTION
|
||||
Download and install the chocolatey default packages for Workstations
|
||||
|
||||
.NOTES
|
||||
These are the chocolatey default packages, that we want to have on all new systems
|
||||
|
||||
Changelog:
|
||||
1.2.0: Switched from 'Install' to 'upgrade' as Choco command (More flexible and robust)
|
||||
1.1.13: Add Cache Location to all Choco commands and make sure it exist
|
||||
|
||||
Version 1.2.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
|
||||
.LINK
|
||||
https://chocolatey.org/docs
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Download and install the chocolatey default packages for Workstations'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
#region
|
||||
if (-not $env:ChocolateyInstall)
|
||||
{
|
||||
$env:ChocolateyInstall = 'C:\ProgramData\chocolatey'
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ChocoCacheLocation
|
||||
$ChocoCacheLocation = "$env:HOMEDRIVE\temp\choco\"
|
||||
$paramTestPath = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ItemType = 'directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
#endregion ChocoCacheLocation
|
||||
|
||||
#region
|
||||
$paramGetCommand = @{
|
||||
Name = 'Update-SessionEnvironment'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramTestPath = @{
|
||||
Path = "$env:ChocolateyInstall\bin\refreshenv.cmd"
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Get-Command @paramGetCommand)
|
||||
{
|
||||
$null = (Update-SessionEnvironment -WarningAction $SCT -ErrorAction $SCT)
|
||||
}
|
||||
elseif (Test-Path @paramTestPath)
|
||||
{
|
||||
$null = (& "$env:ChocolateyInstall\bin\refreshenv.cmd")
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$null = ([Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 3072)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Verbose -Message 'Unable to set PowerShell to use TLS 1.2.'
|
||||
}
|
||||
|
||||
# Use Windows built-in compression instead of downloading 7zip
|
||||
$env:chocolateyUseWindowsCompression = 'true'
|
||||
|
||||
$AllChocoPackages = @(
|
||||
'Scribus'
|
||||
'InkScape'
|
||||
'gimp'
|
||||
'google-web-designer'
|
||||
'bluefish'
|
||||
'komodo-edit'
|
||||
'bluegriffon'
|
||||
'aptana-studio'
|
||||
'pngoptimizer'
|
||||
'pngoptimizer.commandline'
|
||||
'OptiPNG'
|
||||
'exiftool'
|
||||
'exiftoolgui'
|
||||
'IrfanView'
|
||||
'irfanview-shellextension'
|
||||
'irfanviewplugins'
|
||||
)
|
||||
|
||||
# Initial Package Counter
|
||||
$PackageCounter = 1
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($ChocoPackage in $AllChocoPackages)
|
||||
{
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
Write-Verbose -Message ('Start the installation of ' + $ChocoPackage)
|
||||
|
||||
if ($pscmdlet.ShouldProcess($ChocoPackage, 'Install'))
|
||||
{
|
||||
Write-Progress -Activity ('Installing ' + $ChocoPackage) -Status ('Package ' + $PackageCounter + ' of ' + $($AllChocoPackages.Count)) -PercentComplete (($PackageCounter / $AllChocoPackages.Count) * 100)
|
||||
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" upgrade $ChocoPackage --ignoredetectedreboot --no-progress --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1' --cacheLocation=$ChocoCacheLocation)
|
||||
}
|
||||
catch
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
# Retry with --ignore-checksums - A less secure option!!!
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" upgrade $ChocoPackage --allowemptychecksum --ignore-checksums --ignoredetectedreboot --no-progress --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1' --cacheLocation=$ChocoCacheLocation)
|
||||
# Some Packages (e.g. Sysmon) use the latest and greatest version, the checksum check will cause issues in this case!
|
||||
}
|
||||
}
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ('Installation of ' + $ChocoPackage + ' failed!')
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,259 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Download and install chocolatey default packages for developer Workstations
|
||||
|
||||
.DESCRIPTION
|
||||
Download and install chocolatey default packages for developer Workstations
|
||||
|
||||
.NOTES
|
||||
Some of the stiff is not for regular workstations
|
||||
|
||||
Changelog:
|
||||
1.1.0: Switched from 'Install' to 'upgrade' as Choco command (More flexible and robust)
|
||||
1.0.13: Add Cache Location to all Choco commands and make sure it exist
|
||||
1.0.12: Removed 'choco-cleaner' (Now part of the Default Workstation install)
|
||||
1.0.11: Python is now part of this package
|
||||
1.0.10: Removed some packages from the Dev Default
|
||||
1.0.9: Reformatted
|
||||
1.0.8: Added 'microsoft-edge-insider' and 'microsoft-edge-insider-dev'
|
||||
1.0.7: Added "Firefox", "Chrome", and "graphviz" - Removed from the Default Workstation packages
|
||||
|
||||
Version 1.1.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
|
||||
.LINK
|
||||
https://chocolatey.org/docs
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Download and install chocolatey default packages for developer Workstations'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
#region
|
||||
if (-not $env:ChocolateyInstall)
|
||||
{
|
||||
$env:ChocolateyInstall = 'C:\ProgramData\chocolatey'
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ChocoCacheLocation
|
||||
$ChocoCacheLocation = "$env:HOMEDRIVE\temp\choco\"
|
||||
$paramTestPath = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ItemType = 'directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
#endregion ChocoCacheLocation
|
||||
|
||||
#region
|
||||
$paramGetCommand = @{
|
||||
Name = 'Update-SessionEnvironment'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramTestPath = @{
|
||||
Path = "$env:ChocolateyInstall\bin\refreshenv.cmd"
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Get-Command @paramGetCommand)
|
||||
{
|
||||
$null = (Update-SessionEnvironment -WarningAction $SCT -ErrorAction $SCT)
|
||||
}
|
||||
elseif (Test-Path @paramTestPath)
|
||||
{
|
||||
$null = (& "$env:ChocolateyInstall\bin\refreshenv.cmd")
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$null = ([Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 3072)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Verbose -Message 'Unable to set PowerShell to use TLS 1.2.'
|
||||
}
|
||||
|
||||
# Use Windows built-in compression instead of downloading 7zip
|
||||
$env:chocolateyUseWindowsCompression = 'true'
|
||||
|
||||
$AllChocoPackages = @(
|
||||
'GoogleChrome'
|
||||
'git-fork'
|
||||
'graphviz'
|
||||
'microsoft-edge-insider'
|
||||
'gh'
|
||||
'github-desktop'
|
||||
'Firefox'
|
||||
'winmerge'
|
||||
'electron'
|
||||
'cmake'
|
||||
'regextester'
|
||||
'powershell-preview'
|
||||
'brave'
|
||||
'sysinternals'
|
||||
'chromium'
|
||||
'GoogleChrome'
|
||||
'yarn'
|
||||
'nodejs'
|
||||
'NugetPackageExplorer'
|
||||
'NuGet.ContextMenu'
|
||||
'Paket.PowerShell'
|
||||
'python3'
|
||||
'postman'
|
||||
'fiddler'
|
||||
'lockhunter'
|
||||
'dos2unix'
|
||||
'markpad'
|
||||
'dotnetcore-sdk'
|
||||
'dotnetcore-sdk -version 2.2.0'
|
||||
)
|
||||
|
||||
# Initial Package Counter
|
||||
$PackageCounter = 1
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($ChocoPackage in $AllChocoPackages)
|
||||
{
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
Write-Verbose -Message ('Start the installation of ' + $ChocoPackage)
|
||||
|
||||
if ($pscmdlet.ShouldProcess($ChocoPackage, 'Install'))
|
||||
{
|
||||
Write-Progress -Activity ('Installing ' + $ChocoPackage) -Status ('Package ' + $PackageCounter + ' of ' + $($AllChocoPackages.Count)) -PercentComplete (($PackageCounter / $AllChocoPackages.Count) * 100)
|
||||
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" upgrade $ChocoPackage --ignoredetectedreboot --no-progress --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1' --cacheLocation=$ChocoCacheLocation)
|
||||
}
|
||||
catch
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
# Retry with --ignore-checksums - A less secure option!!!
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" upgrade $ChocoPackage --allowemptychecksum --ignore-checksums --ignoredetectedreboot --no-progress --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1' --cacheLocation=$ChocoCacheLocation)
|
||||
# Some Packages (e.g. Sysmon) use the latest and greatest version, the checksum check will cause issues in this case!
|
||||
}
|
||||
}
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ('Installation of ' + $ChocoPackage + ' failed!')
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,233 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Download and install some Microsoft .NET Runtimes
|
||||
|
||||
.DESCRIPTION
|
||||
Download and install some Microsoft .NET and Core Runtimes as chocolatey default packages
|
||||
|
||||
.NOTES
|
||||
Added dotNET Core and Core SDK to the latest version of this script.
|
||||
We also added dotNET Core SDK version 2.2 for some legacy stuff
|
||||
|
||||
Changelog:
|
||||
1.2.0: Switched from 'Install' to 'upgrade' as Choco command (More flexible and robust)
|
||||
1.1.7: Add Cache Location to all Choco commands and make sure it exist
|
||||
1.1.6: Reformatted
|
||||
1.1.5: Add 'dotnetcore3-desktop-runtime' (Required for PowerToys Package)
|
||||
|
||||
Version 1.2.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
|
||||
.LINK
|
||||
https://chocolatey.org/docs
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Download and install some Microsoft .NET Runtimes'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
#region
|
||||
if (-not $env:ChocolateyInstall)
|
||||
{
|
||||
$env:ChocolateyInstall = 'C:\ProgramData\chocolatey'
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ChocoCacheLocation
|
||||
$ChocoCacheLocation = "$env:HOMEDRIVE\temp\choco\"
|
||||
$paramTestPath = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ItemType = 'directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
#endregion ChocoCacheLocation
|
||||
|
||||
#region
|
||||
$paramGetCommand = @{
|
||||
Name = 'Update-SessionEnvironment'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramTestPath = @{
|
||||
Path = "$env:ChocolateyInstall\bin\refreshenv.cmd"
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Get-Command @paramGetCommand)
|
||||
{
|
||||
$null = (Update-SessionEnvironment -WarningAction $SCT -ErrorAction $SCT)
|
||||
}
|
||||
elseif (Test-Path @paramTestPath)
|
||||
{
|
||||
$null = (& "$env:ChocolateyInstall\bin\refreshenv.cmd")
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$null = ([Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 3072)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Verbose -Message 'Unable to set PowerShell to use TLS 1.2.'
|
||||
}
|
||||
|
||||
# Use Windows built-in compression instead of downloading 7zip
|
||||
$env:chocolateyUseWindowsCompression = 'true'
|
||||
|
||||
$AllChocoPackages = @(
|
||||
'DotNet3.5'
|
||||
'DotNet4.5'
|
||||
'dotnet4.7'
|
||||
'dotnetfx'
|
||||
'dotnetcore'
|
||||
'dotnetcore3-desktop-runtime'
|
||||
)
|
||||
|
||||
# Initial Package Counter
|
||||
$PackageCounter = 1
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($ChocoPackage in $AllChocoPackages)
|
||||
{
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
Write-Verbose -Message ('Start the installation of ' + $ChocoPackage)
|
||||
|
||||
if ($pscmdlet.ShouldProcess($ChocoPackage, 'Install'))
|
||||
{
|
||||
Write-Progress -Activity ('Installing ' + $ChocoPackage) -Status ('Package ' + $PackageCounter + ' of ' + $($AllChocoPackages.Count)) -PercentComplete (($PackageCounter / $AllChocoPackages.Count) * 100)
|
||||
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" upgrade $ChocoPackage --ignoredetectedreboot --no-progress --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1' --cacheLocation=$ChocoCacheLocation)
|
||||
}
|
||||
catch
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
# Retry with --ignore-checksums - A less secure option!!!
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" upgrade $ChocoPackage --allowemptychecksum --ignore-checksums --ignoredetectedreboot --no-progress --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1' --cacheLocation=$ChocoCacheLocation)
|
||||
# Some Packages (e.g. Sysmon) use the latest and greatest version, the checksum check will cause issues in this case!
|
||||
}
|
||||
}
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ('Installation of ' + $ChocoPackage + ' failed!')
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,222 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Download and install some legacy Microsoft Visual C++ Redistributable
|
||||
|
||||
.DESCRIPTION
|
||||
Download and install some legacy Microsoft Visual C++ Redistributable as chocolatey default packages
|
||||
|
||||
.NOTES
|
||||
We install the following: 2013, 2015, 2017, and vcredist140
|
||||
|
||||
Changelog:
|
||||
1.1.0: Switched from 'Install' to 'upgrade' as Choco command (More flexible and robust)
|
||||
1.0.9: Add Cache Location to all Choco commands and make sure it exist
|
||||
|
||||
Version 1.1.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
|
||||
.LINK
|
||||
https://chocolatey.org/docs
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Download and install some legacy Microsoft Visual C++ Redistributable'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
#region
|
||||
if (-not $env:ChocolateyInstall)
|
||||
{
|
||||
$env:ChocolateyInstall = 'C:\ProgramData\chocolatey'
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ChocoCacheLocation
|
||||
$ChocoCacheLocation = "$env:HOMEDRIVE\temp\choco\"
|
||||
$paramTestPath = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $ChocoCacheLocation
|
||||
ItemType = 'directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
#endregion ChocoCacheLocation
|
||||
|
||||
#region
|
||||
if (Get-Command -Name Update-SessionEnvironment -WarningAction $SCT -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Update-SessionEnvironment -WarningAction $SCT -ErrorAction $SCT)
|
||||
}
|
||||
elseif (Test-Path -Path "$env:ChocolateyInstall\bin\refreshenv.cmd" -WarningAction $SCT -ErrorAction $SCT)
|
||||
{
|
||||
$null = (& "$env:ChocolateyInstall\bin\refreshenv.cmd")
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$null = ([Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 3072)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Verbose -Message 'Unable to set PowerShell to use TLS 1.2.'
|
||||
}
|
||||
|
||||
# Use Windows built-in compression instead of downloading 7zip
|
||||
$env:chocolateyUseWindowsCompression = 'true'
|
||||
|
||||
$AllChocoPackages = @(
|
||||
#'vcredist2005'
|
||||
#'vcredist2008'
|
||||
#'vcredist2010'
|
||||
#'vcredist2012'
|
||||
'vcredist2013'
|
||||
'vcredist2015'
|
||||
'vcredist2017'
|
||||
'vcredist140'
|
||||
)
|
||||
|
||||
# Initial Package Counter
|
||||
$PackageCounter = 1
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($ChocoPackage in $AllChocoPackages)
|
||||
{
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
Write-Verbose -Message ('Start the installation of ' + $ChocoPackage)
|
||||
|
||||
if ($pscmdlet.ShouldProcess($ChocoPackage, 'Install'))
|
||||
{
|
||||
Write-Progress -Activity ('Installing ' + $ChocoPackage) -Status ('Package ' + $PackageCounter + ' of ' + $($AllChocoPackages.Count)) -PercentComplete (($PackageCounter / $AllChocoPackages.Count) * 100)
|
||||
|
||||
try
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" upgrade $ChocoPackage --ignoredetectedreboot --no-progress --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1' --cacheLocation=$ChocoCacheLocation)
|
||||
}
|
||||
catch
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
# Retry with --ignore-checksums - A less secure option!!!
|
||||
$null = (& "$env:ChocolateyInstall\bin\choco.exe" upgrade $ChocoPackage --allowemptychecksum --ignore-checksums --ignoredetectedreboot --no-progress --acceptlicense --limitoutput --no-progress --yes --force --params 'ALLUSERS=1' --cacheLocation=$ChocoCacheLocation)
|
||||
# Some Packages (e.g. Sysmon) use the latest and greatest version, the checksum check will cause issues in this case!
|
||||
}
|
||||
}
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ('Installation of ' + $ChocoPackage + ' failed!')
|
||||
|
||||
# Add Package Step
|
||||
$PackageCounter++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,220 @@
|
||||
#requires -Version 3.0
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Download and install latest version of Microsoft Teams
|
||||
|
||||
.DESCRIPTION
|
||||
Force the download and the installation latest version of Microsoft Teams for the used OS architecture
|
||||
|
||||
.NOTES
|
||||
Early testing release - Future releases might get some parameters
|
||||
|
||||
Changelog:
|
||||
2.0.0: Changed back to the MSI installation
|
||||
1.0.4: Reformatted
|
||||
1.0.3: Removed the Firewall Rule creation (Now part of Invoke-TweakTeamsClientFirewall.ps1)
|
||||
1.0.2: Removed the WMI call to find OS architecture - Replaced with native .Net type System.IntPtr
|
||||
1.0.1: Use BitsTransfer instead of Invoke-WebRequest
|
||||
1.0.0: Initial Release
|
||||
|
||||
Version 2.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
|
||||
.LINK
|
||||
https://docs.microsoft.com/en-us/microsoftteams/msi-deployment
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Download and install latest version of the Microsoft Teams MSI package'
|
||||
|
||||
# Default URL (Assume we use 64Bit)
|
||||
[string]$Teams64BitUrl = 'https://teams.microsoft.com/downloads/desktopurl?env=production&plat=windows&arch=x64&managedInstaller=true&download=true'
|
||||
|
||||
#region PossibleParameters
|
||||
# Where to Store it
|
||||
[string]$Target = ($env:Temp)
|
||||
|
||||
# Install Switch
|
||||
[string]$Arguments = 'OPTIONS="noAutoStart=true" ALLUSERS=1 /qn /norestart'
|
||||
#endregion PossibleParameters
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
$STP = 'Stop'
|
||||
#endregion Defaults
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Processor architecture will set the installer (64Bit is the default)
|
||||
switch ([IntPtr]::Size)
|
||||
{
|
||||
4
|
||||
{
|
||||
Write-Warning -Message 'You have a 32-bit processor - This is no longer supported by enabling Technology!' -WarningAction Continue
|
||||
|
||||
$Url = 'https://teams.microsoft.com/downloads/desktopurl?env=production&plat=windows&managedInstaller=true&download=true'
|
||||
}
|
||||
Default
|
||||
{
|
||||
Write-Verbose -Message 'Use the default: 64-bit processor'
|
||||
|
||||
$Url = $Teams64BitUrl
|
||||
}
|
||||
}
|
||||
|
||||
# Get the URL
|
||||
$request = (Invoke-WebRequest -Uri $Url -MaximumRedirection 0 -ErrorAction $SCT)
|
||||
|
||||
if ($request.StatusDescription -eq 'found')
|
||||
{
|
||||
# Get the full path of the downloaded installer
|
||||
$paramSplitPath = @{
|
||||
Path = $request.Headers.Location
|
||||
Leaf = $true
|
||||
}
|
||||
$Installer = ($Target + '\' + (Split-Path @paramSplitPath))
|
||||
|
||||
Write-Verbose -Message ('Downloading {0} to {1}' -f $request.Headers.Location, $Installer)
|
||||
|
||||
# Use BitsTransfer to download the latest installer
|
||||
$paramStartBitsTransfer = @{
|
||||
Source = $request.Headers.Location
|
||||
Destination = $Installer
|
||||
Priority = 'Foreground'
|
||||
TransferPolicy = 'Always'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Start-BitsTransfer @paramStartBitsTransfer)
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose -Message ('Answer: {0}' -f $request.StatusDescription)
|
||||
|
||||
Write-Error -Message 'Unable to download the Teams MSI Installer' -ErrorAction $STP
|
||||
|
||||
# We are done
|
||||
break
|
||||
}
|
||||
|
||||
# Install the Microsoft Teams client
|
||||
$paramTestPath = @{
|
||||
Path = $Installer
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
Write-Verbose -Message 'Running installer Microsoft Teams'
|
||||
|
||||
$paramStartProcess = @{
|
||||
FilePath = $Installer
|
||||
ArgumentList = $Arguments
|
||||
Wait = $true
|
||||
PassThru = $true
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$InstallerProcess = (Start-Process @paramStartProcess)
|
||||
|
||||
if (($InstallerProcess | Select-Object -ExpandProperty ExitCode) -eq 0)
|
||||
{
|
||||
Write-Verbose -Message 'Installed Microsoft Teams version'
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Warning -Message ('Installer exit code: {0}.' -f $InstallerProcess.ExitCode)
|
||||
}
|
||||
|
||||
Write-Verbose -Message ('Removing file: {0}' -f $Installer)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = $Installer
|
||||
Confirm = $false
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
else
|
||||
{
|
||||
# get error record
|
||||
[Management.Automation.ErrorRecord]$e = $_
|
||||
|
||||
# retrieve information about runtime error
|
||||
$info = [PSCustomObject]@{
|
||||
Exception = $e.Exception.Message
|
||||
Reason = $e.CategoryInfo.Reason
|
||||
Target = $e.CategoryInfo.TargetName
|
||||
Script = $e.InvocationInfo.ScriptName
|
||||
Line = $e.InvocationInfo.ScriptLineNumber
|
||||
Column = $e.InvocationInfo.OffsetInLine
|
||||
}
|
||||
|
||||
# output information. Post-process collected info, and log info (optional)
|
||||
$info | Out-String | Write-Verbose
|
||||
|
||||
$paramWriteError = @{
|
||||
Message = $e.Exception.Message
|
||||
ErrorAction = $STP
|
||||
Exception = $e.Exception
|
||||
TargetObject = $e.CategoryInfo.TargetName
|
||||
}
|
||||
Write-Error @paramWriteError
|
||||
|
||||
# We are done
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
if ($InstallerProcess.ExitCode)
|
||||
{
|
||||
exit($InstallerProcess.ExitCode)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,164 @@
|
||||
#requires -Version 2.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Install some additional PowerShell Modules for Developers
|
||||
|
||||
.DESCRIPTION
|
||||
Install some additional PowerShell Modules for Developers from the PowerShell Gallery
|
||||
|
||||
.NOTES
|
||||
Version 1.0.5
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Install some additional developer related PowerShell Modules'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
|
||||
# Every System should have these Modules
|
||||
$PowerShellModuleList = @(
|
||||
'ExchangeOnlineManagement'
|
||||
'ADAL.PS'
|
||||
'Az'
|
||||
'AzureAD'
|
||||
'AzureADPreview'
|
||||
'BuildHelpers'
|
||||
'ChangelogManagement'
|
||||
'Configuration'
|
||||
'CredentialManager'
|
||||
'ExchangeOnlineShell'
|
||||
'Exch-Rest'
|
||||
'EXOTools'
|
||||
'ImportExcel'
|
||||
'InvokeBuild'
|
||||
'Invoke-CommandAs'
|
||||
'Microsoft.Graph'
|
||||
'SharePointPnPPowerShellOnline'
|
||||
'Microsoft.Online.SharePoint.PowerShell'
|
||||
'MicrosoftGraphAPI'
|
||||
'MicrosoftGraphSecurity'
|
||||
'MicrosoftStaffHub'
|
||||
'ModuleBuild'
|
||||
'ModuleBuilder'
|
||||
'MSCloudLoginAssistant'
|
||||
'MSGraphAPI'
|
||||
'MSGraphIntuneManagement'
|
||||
'MSGraphTokenLifetimePolicy'
|
||||
'MSOLLicenseManagement'
|
||||
'MSOnline'
|
||||
'Office365GraphAPI'
|
||||
'OneDrive'
|
||||
'ORCA'
|
||||
'platyPS'
|
||||
'Plaster'
|
||||
'PlasterManifestDSL'
|
||||
'Pode'
|
||||
'Polaris'
|
||||
'PoshNotify'
|
||||
'powershell-yaml'
|
||||
'psake'
|
||||
'PSCodeHealth'
|
||||
'PScribo'
|
||||
'PSDepend'
|
||||
'PSModuleBuild'
|
||||
'PSModuleBuildHelper'
|
||||
'PSModuleDevelopment'
|
||||
'PSParseHTML'
|
||||
'PSPesterTest'
|
||||
'PSTeams'
|
||||
)
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Force the installation of the Modules listed above
|
||||
$null = ($PowerShellModuleList | ForEach-Object -Process {
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
$paramInstallModule = @{
|
||||
Name = $_
|
||||
Scope = 'AllUsers'
|
||||
Repository = 'PSGallery'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
AllowClobber = $true
|
||||
SkipPublisherCheck = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
(Install-Module @paramInstallModule)
|
||||
|
||||
Start-Sleep -Seconds 5
|
||||
})
|
||||
|
||||
# Refresh
|
||||
$paramGetModule = @{
|
||||
ListAvailable = $true
|
||||
Refresh = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Module @paramGetModule)
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2020, Beyond Datacenter
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,117 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Install some mandatory PowerShell Modules
|
||||
|
||||
.DESCRIPTION
|
||||
Install some mandatory PowerShell Modules from the PowerShell Gallery
|
||||
|
||||
.NOTES
|
||||
Version 1.0.2
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Install some mandatory PowerShell Modules'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
# Every System should have these Modules
|
||||
$PowerShellModuleList = @(
|
||||
'PoShKeePass'
|
||||
'Pester'
|
||||
'PackageManagement'
|
||||
'PowerShellGet'
|
||||
'PSScriptAnalyzer'
|
||||
'posh-git'
|
||||
'PSWindowsUpdate'
|
||||
'BurntToast'
|
||||
)
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Force the installation of the Modules listed above
|
||||
$null = ($PowerShellModuleList | ForEach-Object -Process {
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object -FilterScript {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
$paramInstallModule = @{
|
||||
Name = $_
|
||||
Scope = 'AllUsers'
|
||||
Repository = 'PSGallery'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
AllowClobber = $true
|
||||
SkipPublisherCheck = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Install-Module @paramInstallModule)
|
||||
|
||||
Start-Sleep -Seconds 5
|
||||
})
|
||||
|
||||
# Refresh
|
||||
$null = (Get-Module -ListAvailable -Refresh -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,150 @@
|
||||
#requires -Version 3.0 -Modules BitsTransfer -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Download and install the Skype for Business Online PowerShell Module
|
||||
|
||||
.DESCRIPTION
|
||||
Download and install the Skype for Business Online PowerShell Module
|
||||
|
||||
.NOTES
|
||||
It may be necessary to set up Windows Remote Management (WinRM)!
|
||||
|
||||
If the connect to Skype for Business Online and/or Microsoft Teams requires to,
|
||||
please execute the following command(s) in an administrative (elevated) command prompt/PowerShell:
|
||||
|
||||
winrm quickconfig
|
||||
|
||||
And optionally this (for legacy authentication fallback support):
|
||||
winrm set winrm/config/client/auth@{Basic="true"}
|
||||
|
||||
Changelog:
|
||||
1.0.0: Initial Release
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Warning -Message 'This module is no longer supported and recommended!'
|
||||
Write-Warning -Message 'Please use the Microsoft Teams Module instead!!!'
|
||||
|
||||
exit 1
|
||||
|
||||
Write-Output -InputObject 'Download and install the Skype for Business Online PowerShell Module'
|
||||
|
||||
# Default URL
|
||||
[string]$SkypeOnlinePowerShellUrl = 'https://download.microsoft.com/download/2/0/5/2050B39B-4DA5-48E0-B768-583533B42C3B/SkypeOnlinePowerShell.exe'
|
||||
|
||||
#region PossibleParameters
|
||||
# Where to Store it
|
||||
[string]$Target = ($env:Temp)
|
||||
|
||||
# File Name
|
||||
[string]$TargetName = 'SkypeOnlinePowerShell.exe'
|
||||
|
||||
# Install Switch
|
||||
[string]$Arguments = '/install /quiet /norestart'
|
||||
#endregion PossibleParameters
|
||||
|
||||
#region Defaults
|
||||
# Set the full path of the downloaded installer
|
||||
[string]$InstallerPackage = ($Target + '\' + $TargetName)
|
||||
|
||||
$SCT = 'SilentlyContinue'
|
||||
$STP = 'Stop'
|
||||
#endregion Defaults
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Use BitsTransfer to download the latest installer
|
||||
$paramStartBitsTransfer = @{
|
||||
Source = $SkypeOnlinePowerShellUrl
|
||||
Destination = $InstallerPackage
|
||||
Priority = 'Foreground'
|
||||
TransferPolicy = 'Always'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Start-BitsTransfer @paramStartBitsTransfer)
|
||||
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $InstallerPackage
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramGetItemProperty = @{
|
||||
Path = $InstallerPackage
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$InstallerVersion = ((Get-ItemProperty @paramGetItemProperty).VersionInfo.ProductVersion)
|
||||
|
||||
Write-Verbose -Message ('Running SkypeOnlinePowerShell installer version {0}' -f $InstallerVersion)
|
||||
|
||||
$paramStartProcess = @{
|
||||
FilePath = $InstallerPackage
|
||||
ArgumentList = $Arguments
|
||||
Wait = $true
|
||||
PassThru = $true
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$InstallerProcess = (Start-Process @paramStartProcess)
|
||||
|
||||
if (($InstallerProcess | Select-Object -ExpandProperty ExitCode) -eq 0)
|
||||
{
|
||||
Write-Verbose -Message ('Installed FSLogix version {0}' -f $InstallerVersion)
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Warning -Message ('Installer exit code {0}.' -f $InstallerProcess.ExitCode)
|
||||
}
|
||||
|
||||
Write-Verbose -Message ('Removing file: {0}' -f $InstallerPackage)
|
||||
|
||||
# Remove the downloaded Installaer Package
|
||||
$paramRemoveItem = @{
|
||||
Path = $InstallerPackage
|
||||
Confirm = $false
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,147 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Download and install the latest WinGet release from GitHub
|
||||
|
||||
.DESCRIPTION
|
||||
Download and install the latest WinGet release from GitHub
|
||||
|
||||
.NOTES
|
||||
Version 1.0.1
|
||||
|
||||
Original Script by Adriano Cahete <https://adrianocahete.dev/>
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
$SCT = 'SilentlyContinue'
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
$BaseDirectory = 'c:\install\files\'
|
||||
|
||||
# Download latest release from GitHub
|
||||
$Repo = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Query the API to get the url of the zip
|
||||
$paramInvokeRestMethod = @{
|
||||
Method = 'Get'
|
||||
Uri = $Repo
|
||||
ErrorAction = 'Stop'
|
||||
}
|
||||
$APIResponse = (Invoke-RestMethod @paramInvokeRestMethod)
|
||||
$FileUrl = $APIResponse.assets.browser_download_url
|
||||
|
||||
# Download the file to the current location
|
||||
$fileName = "$($APIResponse.name.Replace(' ', '_')).appxbundle"
|
||||
$OutputPath = ($BaseDirectory + $fileName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $BaseDirectory
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $BaseDirectory
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
$paramPushLocation = @{
|
||||
Path = $BaseDirectory
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Push-Location @paramPushLocation)
|
||||
|
||||
Write-Verbose -Message "Downloading $fileName ...`n"
|
||||
|
||||
$paramInvokeRestMethod = @{
|
||||
Method = 'Get'
|
||||
Uri = $FileUrl
|
||||
OutFile = $OutputPath
|
||||
ErrorAction = 'Stop'
|
||||
}
|
||||
$null = (Invoke-RestMethod @paramInvokeRestMethod)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $OutputPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
Write-Verbose -Message "`nInstalling $fileName ...`n"
|
||||
|
||||
$paramAddAppxPackage = @{
|
||||
Path = $OutputPath
|
||||
ForceTargetApplicationShutdown = $true
|
||||
InstallAllResources = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Add-AppxPackage @paramAddAppxPackage)
|
||||
|
||||
$null = (Pop-Location -ErrorAction $SCT)
|
||||
|
||||
# TODO: Check
|
||||
if (Test-Path -Path 'C:\ProgramData\chocolatey\bin\RefreshEnv.cmd' -ErrorAction $SCT)
|
||||
{
|
||||
C:\ProgramData\chocolatey\bin\RefreshEnv.cmd
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$WinGetVersion = (winget.exe --version)
|
||||
Write-Output -InputObject "WinGet version is: $WinGetVersion"
|
||||
Write-Output -InputObject "`WinGet is installed. Try to run the 'winget' command.`n"
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Error -Message "`WinGet is not installed. Try to install from MS Store instead`n" -ErrorAction Stop
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Error -Message "`WinGet Installer not found. Try to install from MS Store instead`n" -ErrorAction Stop
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
# =============================================================
|
||||
# Copyright 2020 Adriano Cahete <https://adrianocahete.dev/>
|
||||
# TODO: Add License
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# =============================================================
|
||||
|
||||
# Install Winget
|
||||
# TODO: Check windows version
|
||||
# TODO: Check if it's easier to get from repository or MS Store
|
||||
# TODO: Check if Sideloading is enabled - https://docs.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development
|
||||
# TODO: Do the option to enable sideloading from PS console (I don't know even it's possible)
|
||||
# TODO: Clear old files before start
|
||||
@@ -0,0 +1,173 @@
|
||||
#requires -Version 2.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Backup all BitLocker Recovery Key to AzureAD
|
||||
|
||||
.DESCRIPTION
|
||||
Backup all BitLocker Recovery Key to AzureAD
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Invoke-BackupBitLockerKeyToAAD.ps1
|
||||
|
||||
.NOTES
|
||||
Version 1.0.0
|
||||
|
||||
The multiple recovery passwords part is still unstable
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'None')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Backup all BitLocker Recovery Key to AzureAD'
|
||||
|
||||
$SCT = 'SilentlyContinue'
|
||||
$STP = 'Stop'
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
$keyID = $null
|
||||
|
||||
$paramGetBitLockerVolume = @{
|
||||
MountPoint = $env:systemdrive
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$keyID = (Get-BitLockerVolume @paramGetBitLockerVolume | Select-Object -ExpandProperty keyprotector | Where-Object -FilterScript {
|
||||
$_.KeyProtectorType -eq 'RecoveryPassword'
|
||||
})
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
try
|
||||
{
|
||||
if (-not $keyID)
|
||||
{
|
||||
# In case there is no Recovery Password, lets create new one
|
||||
$paramAddBitLockerKeyProtector = @{
|
||||
MountPoint = $env:systemdrive
|
||||
RecoveryPasswordProtector = $true
|
||||
ErrorAction = $STP
|
||||
WarningAction = $SCT
|
||||
Confirm = $false
|
||||
}
|
||||
$null = (Add-BitLockerKeyProtector @paramAddBitLockerKeyProtector)
|
||||
|
||||
$paramGetBitLockerVolume = @{
|
||||
MountPoint = $env:systemdrive
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$paramGetBitLockerVolume = @{
|
||||
MountPoint = $env:systemdrive
|
||||
ErrorAction = $STP
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$keyID = (Get-BitLockerVolume @paramGetBitLockerVolume | Select-Object -ExpandProperty keyprotector | Where-Object -FilterScript {
|
||||
$_.KeyProtectorType -eq 'RecoveryPassword'
|
||||
})
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw
|
||||
break
|
||||
}
|
||||
|
||||
$paramBackupToAADBitLockerKeyProtector = @{
|
||||
MountPoint = $env:systemdrive
|
||||
ErrorAction = $STP
|
||||
WarningAction = $SCT
|
||||
}
|
||||
|
||||
if ($keyID.Count -cgt 1)
|
||||
{
|
||||
for ($i = 0; $i -le $keyID.Count; $i++)
|
||||
{
|
||||
if ($keyID[$i])
|
||||
{
|
||||
Write-Verbose -Message ('Start Backup BitLockerKey {0}' -f $i)
|
||||
|
||||
try
|
||||
{
|
||||
$paramBackupToAADBitLockerKeyProtector = @{
|
||||
KeyProtectorId = $keyID.KeyProtectorId[$i]
|
||||
MountPoint = $env:systemdrive
|
||||
ErrorAction = $STP
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (BackupToAAD-BitLockerKeyProtector @paramBackupToAADBitLockerKeyProtector)
|
||||
|
||||
Write-Verbose -Message ('Done Backup BitLockerKey {0}' -f $i)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ('Unable to Backup BitLockerKey {0}' -f $i)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose -Message 'Start Backup BitLockerKey'
|
||||
|
||||
try
|
||||
{
|
||||
$paramBackupToAADBitLockerKeyProtector = @{
|
||||
KeyProtectorId = $keyID.KeyProtectorId
|
||||
MountPoint = $env:systemdrive
|
||||
ErrorAction = $STP
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (BackupToAAD-BitLockerKeyProtector @paramBackupToAADBitLockerKeyProtector)
|
||||
|
||||
Write-Verbose -Message 'Done Backup BitLockerKey'
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message 'Unable to Backup BitLockerKey'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,323 @@
|
||||
#requires -Version 3.0 -Modules BitsTransfer -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Download, install, and Tweak System and Apps for Terminal Server use
|
||||
|
||||
.DESCRIPTION
|
||||
Download, install, and Tweak System and Apps for Terminal Server (WVD/VDI/WDS) use
|
||||
|
||||
.NOTES
|
||||
Early testing release - Future releases might get some parameters
|
||||
|
||||
Changelog:
|
||||
1.0.1: Reformatted
|
||||
1.0.0: Initial Release
|
||||
|
||||
Version 1.0.1
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Download, install, and Tweak System and Apps for Terminal Server use'
|
||||
|
||||
# Default URL (Assume we use 64Bit)
|
||||
[string]$FSLogixUrl = 'https://aka.ms/fslogix_download'
|
||||
|
||||
#region PossibleParameters
|
||||
# Where to Store it
|
||||
[string]$Target = ($env:Temp)
|
||||
|
||||
# File Name
|
||||
[string]$TargetName = 'fslogix.zip'
|
||||
|
||||
# Install Switch
|
||||
[string]$Arguments = '/install /quiet /norestart'
|
||||
#endregion PossibleParameters
|
||||
|
||||
#region Defaults
|
||||
# Set the full path of the downloaded installer
|
||||
[string]$InstallerPackage = ($Target + '\' + $TargetName)
|
||||
|
||||
[string]$InstallerDestination = (($InstallerPackage).Replace('.zip', ''))
|
||||
[string]$InstallerExecutable = ($InstallerDestination + '\x64\Release\FSLogixAppsSetup.exe')
|
||||
$SCT = 'SilentlyContinue'
|
||||
$STP = 'Stop'
|
||||
#endregion Defaults
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
Write-Verbose -Message ('Downloading {0} to {1}' -f $TargetName, $InstallerPackage)
|
||||
|
||||
# Use BitsTransfer to download the latest installer
|
||||
$paramStartBitsTransfer = @{
|
||||
Source = $FSLogixUrl
|
||||
Destination = $InstallerPackage
|
||||
Priority = 'Foreground'
|
||||
TransferPolicy = 'Always'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Start-BitsTransfer @paramStartBitsTransfer)
|
||||
|
||||
# Expand FSLogix Installer
|
||||
$paramTestPath = @{
|
||||
Path = $InstallerPackage
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramTestPath = @{
|
||||
Path = $InstallerDestination
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $InstallerDestination
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ItemType = 'Directory'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
# Expand-Archive is to buggy!
|
||||
$paramAddType = @{
|
||||
AssemblyName = 'System.IO.Compression.FileSystem'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Add-Type @paramAddType)
|
||||
$null = ([IO.Compression.ZipFile]::ExtractToDirectory($InstallerPackage, $InstallerDestination))
|
||||
}
|
||||
catch
|
||||
{
|
||||
# OK! That is crappy, but it still works well as a fallback.
|
||||
$paramNewObject = @{
|
||||
ComObject = 'Shell.Application'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$shellApp = (New-Object @paramNewObject)
|
||||
$shellZip = $shellApp.NameSpace([String]$InstallerPackage)
|
||||
$shellDest = $shellApp.NameSpace($InstallerDestination)
|
||||
$shellDest.CopyHere($shellZip.items())
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# get error record
|
||||
[Management.Automation.ErrorRecord]$e = $_
|
||||
|
||||
# retrieve information about runtime error
|
||||
$info = [PSCustomObject]@{
|
||||
Exception = $e.Exception.Message
|
||||
Reason = $e.CategoryInfo.Reason
|
||||
Target = $e.CategoryInfo.TargetName
|
||||
Script = $e.InvocationInfo.ScriptName
|
||||
Line = $e.InvocationInfo.ScriptLineNumber
|
||||
Column = $e.InvocationInfo.OffsetInLine
|
||||
}
|
||||
|
||||
# output information. Post-process collected info, and log info (optional)
|
||||
$info | Out-String | Write-Verbose
|
||||
|
||||
$paramWriteError = @{
|
||||
Message = $e.Exception.Message
|
||||
ErrorAction = $STP
|
||||
Exception = $e.Exception
|
||||
TargetObject = $e.CategoryInfo.TargetName
|
||||
}
|
||||
Write-Error @paramWriteError
|
||||
|
||||
# We are done
|
||||
break
|
||||
}
|
||||
|
||||
# Install FSLogix
|
||||
$paramTestPath = @{
|
||||
Path = $InstallerExecutable
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramGetItemProperty = @{
|
||||
Path = $InstallerExecutable
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$InstallerVersion = ((Get-ItemProperty @paramGetItemProperty).VersionInfo.ProductVersion)
|
||||
|
||||
Write-Verbose -Message ('Running FSLogix installer version {0}' -f $InstallerVersion)
|
||||
|
||||
$paramStartProcess = @{
|
||||
FilePath = $InstallerExecutable
|
||||
ArgumentList = $Arguments
|
||||
Wait = $true
|
||||
PassThru = $true
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$InstallerProcess = (Start-Process @paramStartProcess)
|
||||
|
||||
if (($InstallerProcess | Select-Object -ExpandProperty ExitCode) -eq 0)
|
||||
{
|
||||
Write-Verbose -Message ('Installed FSLogix version {0}' -f $InstallerVersion)
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Warning -Message ('Installer exit code {0}.' -f $InstallerProcess.ExitCode)
|
||||
}
|
||||
|
||||
Write-Verbose -Message ('Removing file: {0}' -f $InstallerPackage)
|
||||
|
||||
# Remove the downloaded Installaer Package
|
||||
$paramRemoveItem = @{
|
||||
Path = $InstallerPackage
|
||||
Confirm = $false
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
|
||||
# Install the expanded stuff
|
||||
$paramRemoveItem = @{
|
||||
Path = $InstallerDestination
|
||||
Recurse = $true
|
||||
Confirm = $false
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
|
||||
# Legacy HKLM Path for WVD/VDI/WDS Environment
|
||||
$paramNewItem = @{
|
||||
Path = 'HKLM:\SOFTWARE\Citrix\PortICA'
|
||||
Confirm = $false
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
|
||||
# Ensure that the registry path exists
|
||||
$paramNewItem = @{
|
||||
Path = 'HKLM:\SOFTWARE\Microsoft\Teams'
|
||||
Confirm = $false
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
|
||||
# Tell Microsoft Teams that it runs in an WVD/VDI/WDS Environment
|
||||
# Source: https://docs.microsoft.com/en-us/azure/virtual-desktop/teams-on-wvd
|
||||
$paramNewItemProperty = @{
|
||||
Path = 'HKLM:\SOFTWARE\Microsoft\Teams'
|
||||
Name = 'IsWVDEnvironment'
|
||||
PropertyType = 'DWORD'
|
||||
Value = 1
|
||||
Confirm = $false
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
|
||||
# Ensure that the registry path exists
|
||||
$paramNewItem = @{
|
||||
Path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32'
|
||||
Confirm = $false
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
|
||||
# Do not start Microsoft Teams after Login
|
||||
$paramNewItemProperty = @{
|
||||
Path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32'
|
||||
Name = 'Teams'
|
||||
PropertyType = 'Binary'
|
||||
Value = ([byte[]](0x01, 0x00, 0x00, 0x00, 0x1a, 0x19, 0xc3, 0xb9, 0x62, 0x69, 0xd5, 0x01))
|
||||
Confirm = $false
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-ItemProperty @paramNewItemProperty)
|
||||
}
|
||||
else
|
||||
{
|
||||
# get error record
|
||||
[Management.Automation.ErrorRecord]$e = $_
|
||||
|
||||
# retrieve information about runtime error
|
||||
$info = [PSCustomObject]@{
|
||||
Exception = $e.Exception.Message
|
||||
Reason = $e.CategoryInfo.Reason
|
||||
Target = $e.CategoryInfo.TargetName
|
||||
Script = $e.InvocationInfo.ScriptName
|
||||
Line = $e.InvocationInfo.ScriptLineNumber
|
||||
Column = $e.InvocationInfo.OffsetInLine
|
||||
}
|
||||
|
||||
# output information. Post-process collected info, and log info (optional)
|
||||
$info | Out-String | Write-Verbose
|
||||
|
||||
$paramWriteError = @{
|
||||
Message = $e.Exception.Message
|
||||
ErrorAction = $STP
|
||||
Exception = $e.Exception
|
||||
TargetObject = $e.CategoryInfo.TargetName
|
||||
}
|
||||
Write-Error @paramWriteError
|
||||
|
||||
# We are done
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,127 @@
|
||||
#requires -Version 2.0 -Modules ScheduledTasks
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Cleanup some scheduled tasks
|
||||
|
||||
.DESCRIPTION
|
||||
Cleanup some scheduled tasks, mostly auto update related
|
||||
|
||||
.NOTES
|
||||
The Auto updates are great! But we use Choco and our own solution to deploy updates.
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Cleanup some scheduled tasks'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Disable the Brave (Browser) Updater Tasks
|
||||
$paramGetScheduledTask = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$paramDisableScheduledTask = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Get-ScheduledTask @paramGetScheduledTask | Where-Object -FilterScript {
|
||||
(($_.TaskName -like 'BraveSoftwareUpdateTask*') -and ($_.State -ne 'Disabled'))
|
||||
} | Disable-ScheduledTask @paramDisableScheduledTask)
|
||||
|
||||
# Disable the Google Chrome (Browser) Updater Tasks
|
||||
$paramGetScheduledTask = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$paramDisableScheduledTask = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Get-ScheduledTask @paramGetScheduledTask | Where-Object -FilterScript {
|
||||
(($_.TaskName -like 'GoogleUpdateTaskMachine*') -and ($_.State -ne 'Disabled'))
|
||||
} | Disable-ScheduledTask @paramDisableScheduledTask)
|
||||
|
||||
<#
|
||||
# Disable the Microsoft Chromium Edge (Browser) Updater Tasks
|
||||
$paramGetScheduledTask = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$paramDisableScheduledTask = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Get-ScheduledTask @paramGetScheduledTask | Where-Object -FilterScript {
|
||||
(($_.TaskName -like 'MicrosoftEdgeUpdateTaskMachine*') -and ($_.State -ne 'Disabled'))
|
||||
} | Disable-ScheduledTask @paramDisableScheduledTask)
|
||||
#>
|
||||
|
||||
# Disable the HP WarrantyChecker Tasks
|
||||
$paramGetScheduledTask = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$paramDisableScheduledTask = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Get-ScheduledTask @paramGetScheduledTask | Where-Object -FilterScript {
|
||||
(($_.TaskName -like 'WarrantyChecker*') -and ($_.State -ne 'Disabled'))
|
||||
} | Disable-ScheduledTask @paramDisableScheduledTask)
|
||||
|
||||
# Disable the Firefox Default Browser Agent Tasks
|
||||
$paramGetScheduledTask = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$paramDisableScheduledTask = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Get-ScheduledTask @paramGetScheduledTask | Where-Object -FilterScript {
|
||||
(($_.TaskName -like 'Firefox Default Browser Agent*') -and ($_.State -ne 'Disabled'))
|
||||
} | Disable-ScheduledTask @paramDisableScheduledTask)
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,96 @@
|
||||
#requires -Version 1.0
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disable some Services
|
||||
|
||||
.DESCRIPTION
|
||||
Disable some Services, mostly auto update related
|
||||
|
||||
.NOTES
|
||||
The Auto updates are great! But we use Choco and our own solution to deploy updates.
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Disable some Services'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
$DisableServices = @(
|
||||
#'edgeupdate'
|
||||
#'edgeupdatem'
|
||||
'gupdate'
|
||||
'gupdatem'
|
||||
)
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($DisableService in $DisableServices)
|
||||
{
|
||||
# Get the Given Service
|
||||
$paramGetService = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$DisableServiceInfo = ($DisableService | Get-Service @paramGetService)
|
||||
|
||||
# Stop the given Service
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
NoWait = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = ($DisableServiceInfo | Stop-Service @paramStopService)
|
||||
|
||||
# Disable the given Service
|
||||
$paramSetService = @{
|
||||
StartupType = 'Manual'
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = ($DisableServiceInfo | Set-Service @paramSetService)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,102 @@
|
||||
#requires -Version 1.0
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disable some System Auto Starts
|
||||
|
||||
.DESCRIPTION
|
||||
Disable some System Auto Starts to save some memory and CPU resources
|
||||
|
||||
.NOTES
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Disable some System Auto Starts'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
$DisableAutoPathList = @(
|
||||
'HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run'
|
||||
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32'
|
||||
'HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder'
|
||||
)
|
||||
|
||||
$DisableAutoStarts = @(
|
||||
'KeePassXC'
|
||||
'KeePass'
|
||||
'KeePass 2 PreLoad'
|
||||
'1Password'
|
||||
'BraveSoftware Update'
|
||||
)
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($item in $DisableAutoStarts)
|
||||
{
|
||||
foreach ($DisableAutoPath in $DisableAutoPathList)
|
||||
{
|
||||
$AutoStartStatus = $null
|
||||
|
||||
$paramGetItemProperty = @{
|
||||
Path = $DisableAutoPath
|
||||
Name = $item
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$AutoStartStatus = (Get-ItemProperty @paramGetItemProperty)
|
||||
|
||||
if ($AutoStartStatus)
|
||||
{
|
||||
$paramSetItemProperty = @{
|
||||
Path = $DisableAutoPath
|
||||
Name = $item
|
||||
Value = ([byte[]](0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00))
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Set-ItemProperty @paramSetItemProperty)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,138 @@
|
||||
#requires -Version 3.0 -Modules NetSecurity -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Tweak the Firewall Rules for Microsoft Teams clients
|
||||
|
||||
.DESCRIPTION
|
||||
Tweak the Firewall Rules for Microsoft Teams clients for all users that have it installed
|
||||
|
||||
.NOTES
|
||||
Early testing release
|
||||
|
||||
Changelog:
|
||||
1.0.1: Reformatted
|
||||
1.0.0: Initial Release
|
||||
|
||||
Version 1.0.1
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Tweak the Firewall Rules for Microsoft Teams clients for all users that have it installed'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Creates firewall rules for Microsoft Teams
|
||||
$AllUsers = $null
|
||||
|
||||
$paramJoinPath = @{
|
||||
Path = $env:SystemDrive
|
||||
ChildPath = 'Users'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetChildItem = @{
|
||||
Path = (Join-Path @paramJoinPath)
|
||||
ErrorAction = $SCT
|
||||
Exclude = 'Public', 'ADMINI~*'
|
||||
}
|
||||
$AllUsers = (Get-ChildItem @paramGetChildItem)
|
||||
|
||||
if ($null -ne $AllUsers)
|
||||
{
|
||||
foreach ($SingleUser in $AllUsers)
|
||||
{
|
||||
# Cleanup
|
||||
$FullTeamsPath = $null
|
||||
|
||||
# get the Executable
|
||||
$paramJoinPath = @{
|
||||
Path = $SingleUser.FullName
|
||||
ChildPath = 'AppData\Local\Microsoft\Teams\Current\Teams.exe'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$FullTeamsPath = (Join-Path @paramJoinPath)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FullTeamsPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramGetNetFirewallApplicationFilter = @{
|
||||
Program = $FullTeamsPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (-not (Get-NetFirewallApplicationFilter @paramGetNetFirewallApplicationFilter))
|
||||
{
|
||||
# Cleanup
|
||||
$NetFirewallRuleName = $null
|
||||
|
||||
# Apply the Rulename
|
||||
$NetFirewallRuleName = ('Teams.exe for user {0}' -f $SingleUser.Name)
|
||||
|
||||
'UDP', 'TCP' | ForEach-Object -Process {
|
||||
$paramNewNetFirewallRule = @{
|
||||
DisplayName = $NetFirewallRuleName
|
||||
Direction = 'Inbound'
|
||||
Profile = 'Any'
|
||||
Program = $FullTeamsPath
|
||||
Action = 'Allow'
|
||||
Protocol = $_
|
||||
Enabled = 'True'
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-NetFirewallRule @paramNewNetFirewallRule)
|
||||
}
|
||||
|
||||
# Cleanup
|
||||
$NetFirewallRuleName = $null
|
||||
}
|
||||
}
|
||||
|
||||
# Cleanup
|
||||
$FullTeamsPath = $null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2020, Beyond Datacenter
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,105 @@
|
||||
#requires -Version 1.0
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disable some User Auto Starts
|
||||
|
||||
.DESCRIPTION
|
||||
Disable some System Auto Starts to save some memory and CPU resources
|
||||
|
||||
.NOTES
|
||||
User can enable them again, if needed
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Disable some User Auto Starts'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
$DisableAutoPathList = @(
|
||||
'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run'
|
||||
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32'
|
||||
'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder'
|
||||
)
|
||||
|
||||
$DisableAutoStarts = @(
|
||||
'KeePassXC'
|
||||
'KeePass'
|
||||
'KeePass 2 PreLoad'
|
||||
'1Password'
|
||||
'BraveSoftware Update'
|
||||
)
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($item in $DisableAutoStarts)
|
||||
{
|
||||
foreach ($DisableAutoPath in $DisableAutoPathList)
|
||||
{
|
||||
$AutoStartStatus = $null
|
||||
|
||||
$paramGetItemProperty = @{
|
||||
Path = $DisableAutoPath
|
||||
Name = $item
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
|
||||
$AutoStartStatus = (Get-ItemProperty @paramGetItemProperty)
|
||||
|
||||
if ($AutoStartStatus)
|
||||
{
|
||||
$paramSetItemProperty = @{
|
||||
Path = $DisableAutoPath
|
||||
Name = $item
|
||||
Value = ([byte[]](0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00))
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Set-ItemProperty @paramSetItemProperty)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,14 @@
|
||||
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection\ -name AllowTelemetry -Value 0
|
||||
Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection\ -name AllowTelemetry
|
||||
|
||||
Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\DiagTrack\ -name Start -Value 4
|
||||
Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\DiagTrack\ -name Start
|
||||
|
||||
Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AutoLogger-Diagtrack-Listener\ -name Start -Value 0
|
||||
Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AutoLogger-Diagtrack-Listener\ -name Start
|
||||
|
||||
Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\wuauserv\ -name Start -Value 4
|
||||
Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\wuauserv\ -name Start
|
||||
|
||||
New-NetFirewallRule -DisplayName "BlockDiagTrack" -Name "BlockDiagTrack" -Direction Outbound -Program "%SystemRoot%\System32\utc_myhost.exe" -Action Block
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
#requires -Version 1.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create plain PowerShell Profiles, if needed
|
||||
|
||||
.DESCRIPTION
|
||||
Create plain PowerShell Profiles, if needed
|
||||
|
||||
.NOTES
|
||||
Changelog:
|
||||
1.0.5: Reformatted:
|
||||
1.0.1: First real release
|
||||
1.0.0: Initial beta version
|
||||
|
||||
Version 1.0.1
|
||||
|
||||
.LINK
|
||||
http://beyend-datacenter.com
|
||||
|
||||
.LINK
|
||||
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7
|
||||
|
||||
.LINK
|
||||
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-5.1
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Create plain PowerShell Profiles, if needed'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$null = (Get-Service -Name 'WSearch' -ErrorAction $SCT | Where-Object { $_.Status -eq 'Running' } | Stop-Service -Force -Confirm:$false -ErrorAction $SCT)
|
||||
|
||||
# Splat the parameters
|
||||
$paramNewItem = @{
|
||||
type = 'file'
|
||||
force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
|
||||
# Splat the parameters
|
||||
$paramTestPath = @{
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $PROFILE @paramTestPath))
|
||||
{
|
||||
$null = (New-Item -Path $PROFILE @paramNewItem)
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $PROFILE.AllUsersAllHosts @paramTestPath))
|
||||
{
|
||||
$null = (New-Item -Path $PROFILE.AllUsersAllHosts @paramNewItem)
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $PROFILE.AllUsersCurrentHost @paramTestPath))
|
||||
{
|
||||
$null = (New-Item -Path $PROFILE.AllUsersCurrentHost @paramNewItem)
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $PROFILE.CurrentUserAllHosts @paramTestPath))
|
||||
{
|
||||
$null = (New-Item -Path $PROFILE.CurrentUserAllHosts @paramNewItem)
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $PROFILE.CurrentUserCurrentHost @paramTestPath))
|
||||
{
|
||||
$null = (New-Item -Path $PROFILE.CurrentUserCurrentHost @paramNewItem)
|
||||
}
|
||||
|
||||
#region ISE
|
||||
$ISEProfileAllUsersCurrentHost = ($PsHome + '\Microsoft.PowerShellISE_profile.ps1')
|
||||
if (-not (Test-Path -Path $ISEProfileAllUsersCurrentHost @paramTestPath))
|
||||
{
|
||||
$null = (New-Item -Path $ISEProfileAllUsersCurrentHost @paramNewItem)
|
||||
}
|
||||
|
||||
$ISEProfileCurrentUserAllHosts = ($Home + '\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1')
|
||||
if (-not (Test-Path -Path $ISEProfileCurrentUserAllHosts @paramTestPath))
|
||||
{
|
||||
$null = (New-Item -Path $ISEProfileCurrentUserAllHosts @paramNewItem)
|
||||
}
|
||||
#endregion ISE
|
||||
|
||||
#region VSCode
|
||||
$VSCodeProfileAllUsersCurrentHost = ($PSHOME + '\Microsoft.VSCode_profile.ps1')
|
||||
if (-not (Test-Path -Path $VSCodeProfileAllUsersCurrentHost @paramTestPath))
|
||||
{
|
||||
$null = (New-Item -Path $VSCodeProfileAllUsersCurrentHost @paramNewItem)
|
||||
}
|
||||
|
||||
$VSCodeProfileCurrentUserAllHosts = ($Home + '\Documents\PowerShell\Microsoft.VSCode_profile.ps1')
|
||||
if (-not (Test-Path -Path $VSCodeProfileCurrentUserAllHosts @paramTestPath))
|
||||
{
|
||||
$null = (New-Item -Path $VSCodeProfileCurrentUserAllHosts @paramNewItem)
|
||||
}
|
||||
#endregion VSCode
|
||||
|
||||
#region PowerShellCore
|
||||
$PSCoreCurrentUserAllHosts = ($Home + '\Documents\PowerShell\profile.ps1')
|
||||
if (-not (Test-Path -Path $PSCoreCurrentUserAllHosts @paramTestPath))
|
||||
{
|
||||
$null = (New-Item -Path $PSCoreCurrentUserAllHosts @paramNewItem)
|
||||
}
|
||||
|
||||
$PSCoreCurrentUserCurrentHost = ($Home + '\Documents\PowerShell\Microsoft.PowerShell_profile.ps1')
|
||||
if (-not (Test-Path -Path $PSCoreCurrentUserCurrentHost @paramTestPath))
|
||||
{
|
||||
$null = (New-Item -Path $PSCoreCurrentUserCurrentHost @paramNewItem)
|
||||
}
|
||||
#endregion PowerShellCore
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,148 @@
|
||||
#requires -Version 2.0 -Modules ScheduledTasks
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a Scheduled Task to keep all Chocolatey Packages up-to-date
|
||||
|
||||
.DESCRIPTION
|
||||
Creates a Scheduled Task to keep all Chocolatey Packages up-to-date, it runs each time a user logs in to this system
|
||||
|
||||
.NOTES
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Creates a Scheduled Task to keep all Chocolatey Packages up-to-date'
|
||||
|
||||
#region Defaults
|
||||
$STP = 'Stop'
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
# Define the Name
|
||||
$ScheduledTaskName = 'Run Choco Upgrade at Login'
|
||||
|
||||
# Define the description as string
|
||||
$ScheduledTaskDescription = 'Scheduled Task to keep all Chocolatey Packages up-to-date'
|
||||
|
||||
# See if choco.exe is available. If not, stop execution
|
||||
$paramGetCommand = @{
|
||||
Name = 'choco.exe'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$chocoCmd = (Get-Command @paramGetCommand | Select-Object -ExpandProperty Source)
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
try
|
||||
{
|
||||
if (-not ($chocoCmd))
|
||||
{
|
||||
Write-Error -Message 'Chocolatey executable not found' -ErrorAction $STP
|
||||
}
|
||||
else
|
||||
{
|
||||
$paramGetScheduledTask = @{
|
||||
TaskName = $ScheduledTaskName
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Get-ScheduledTask @paramGetScheduledTask | Unregister-ScheduledTask -Confirm:$false -ErrorAction $SCT)
|
||||
|
||||
# What to execute
|
||||
$paramNewScheduledTaskAction = @{
|
||||
Execute = $chocoCmd
|
||||
Argument = 'upgrade all -y >NUL 2>&1'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$taskAction = (New-ScheduledTaskAction @paramNewScheduledTaskAction)
|
||||
|
||||
# Trigegr when someone login
|
||||
$paramNewScheduledTaskTrigger = @{
|
||||
AtLogOn = $true
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$taskTrigger = (New-ScheduledTaskTrigger @paramNewScheduledTaskTrigger)
|
||||
|
||||
# Delay the Task for one (1) minute
|
||||
$taskTrigger.Delay = 'PT1M'
|
||||
|
||||
# Who run the task and what run level to use (System and Highest
|
||||
$paramNewScheduledTaskPrincipal = @{
|
||||
UserId = 'SYSTEM'
|
||||
RunLevel = 'Highest'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$taskUserPrincipal = (New-ScheduledTaskPrincipal @paramNewScheduledTaskPrincipal)
|
||||
|
||||
# Win8 is the latest
|
||||
$paramNewScheduledTaskSettingsSet = @{
|
||||
Compatibility = 'Win8'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$taskSettings = (New-ScheduledTaskSettingsSet @paramNewScheduledTaskSettingsSet)
|
||||
|
||||
# Set up the new task
|
||||
$paramNewScheduledTask = @{
|
||||
Action = $taskAction
|
||||
Principal = $taskUserPrincipal
|
||||
Trigger = $taskTrigger
|
||||
Settings = $taskSettings
|
||||
Description = $ScheduledTaskDescription
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$task = (New-ScheduledTask @paramNewScheduledTask)
|
||||
|
||||
# Register the new task
|
||||
$paramRegisterScheduledTask = @{
|
||||
TaskName = $ScheduledTaskName
|
||||
InputObject = $task
|
||||
Force = $true
|
||||
TaskPath = '\'
|
||||
ErrorAction = $STP
|
||||
}
|
||||
$null = (Register-ScheduledTask @paramRegisterScheduledTask)
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Error -Message 'Whoopsie' -ErrorAction $STP
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,473 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Apply the Defender exclusions based on recommendations by Microsoft
|
||||
|
||||
.DESCRIPTION
|
||||
Apply the Defender exclusions based on recommendations by Microsoft,
|
||||
Some additional Controlled Folder Access Allowed Applications will be added as well
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Optimize-MicrosoftDefenderExclusions.ps1
|
||||
|
||||
.NOTES
|
||||
Do not just use set-mppreference here, this might remove any existing exclusions.
|
||||
Might be the right thing to do, but with add-mppreference you append to the list (if exists).
|
||||
|
||||
Changelog:
|
||||
1.0.4: Reformated
|
||||
1.0.3: Add ControlledFolderAccessAllowedApplications handling
|
||||
1.0.2: First real release
|
||||
1.0.0: Intital beta version
|
||||
|
||||
Version 1.0.4
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
|
||||
.LINK
|
||||
https://support.microsoft.com/en-ie/help/822158/virus-scanning-recommendations-for-enterprise-computers-that-are-runni
|
||||
|
||||
.LINK
|
||||
https://docs.microsoft.com/en-us/powershell/module/defender/add-mppreference
|
||||
|
||||
.LINK
|
||||
https://docs.microsoft.com/en-us/powershell/module/defender/set-mppreference
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Apply the Defender exclusions based on recommendations by Microsoft'
|
||||
|
||||
#region
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
#region DefaultExclusions
|
||||
$ExcludePathList = @(
|
||||
"$env:windir\SoftwareDistribution\DataStore\Datastore.edb",
|
||||
"$env:windir\SoftwareDistribution\DataStore\Logs\Edb*.jrs",
|
||||
"$env:windir\SoftwareDistribution\DataStore\Logs\Edb.chk",
|
||||
"$env:windir\SoftwareDistribution\DataStore\Logs\Tmp.edb",
|
||||
"$env:windir\Security\Database\*.edb",
|
||||
"$env:windir\Security\Database\*.sdb",
|
||||
"$env:windir\Security\Database\*.log",
|
||||
"$env:windir\Security\Database\*.chk",
|
||||
"$env:windir\Security\Database\*.jrs",
|
||||
"$env:windir\Security\Database\*.xml",
|
||||
"$env:windir\Security\Database\*.csv",
|
||||
"$env:windir\Security\Database\*.cmtx",
|
||||
"$env:windir\System32\GroupPolicy\Machine\Registry.pol",
|
||||
"$env:windir\System32\GroupPolicy\Machine\Registry.tmp",
|
||||
"$env:windir\System32\GroupPolicy\User\Registry.pol",
|
||||
"$env:windir\System32\GroupPolicy\User\Registry.tmp",
|
||||
"$env:ProgramData\ntuser.pol",
|
||||
"$env:ProgramData\chocolatey\lib\sysinternals\tools\*.exe"
|
||||
)
|
||||
#endregion DefaultExclusions
|
||||
|
||||
#region AdExclusions
|
||||
# Turn off scanning of Active Directory and Active Directory-related files
|
||||
|
||||
# Exclude the Main NTDS database files.
|
||||
$DSADatabaseFile = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NTDS\Parameters'
|
||||
$DSADatabaseFilePath = ('Registry::' + $DSADatabaseFile)
|
||||
$paramTestPath = @{
|
||||
Path = $DSADatabaseFilePath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramGetItemProperty = @{
|
||||
Path = $DSADatabaseFilePath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$DSADatabaseFileValue = (Get-ItemProperty @paramGetItemProperty | Select-Object -ExpandProperty 'DSA Database file')
|
||||
|
||||
if ($DSADatabaseFileValue)
|
||||
{
|
||||
$ExcludePathList += ($DSADatabaseFileValue)
|
||||
$ExcludePathList += ($DSADatabaseFileValue).Replace('.dit', '.pat')
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose -Message 'No NTDS database files to exclude'
|
||||
}
|
||||
|
||||
# Exclude the Active Directory transaction log files.
|
||||
$DatabaseLogFiles = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NTDS\Parameters'
|
||||
$DatabaseLogFilesPath = ('Registry::' + $DatabaseLogFiles)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $DatabaseLogFilesPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramGetItemProperty = @{
|
||||
Path = $DatabaseLogFilesPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$DatabaseLogFilesPathValue = (Get-ItemProperty @paramGetItemProperty | Select-Object -ExpandProperty 'Database Log Files Path')
|
||||
|
||||
if ($DatabaseLogFilesPathValue)
|
||||
{
|
||||
$ExcludePathList += ($DatabaseLogFilesPathValue + '\EDB*.log')
|
||||
$ExcludePathList += ($DatabaseLogFilesPathValue + '\Res*.log')
|
||||
$ExcludePathList += ($DatabaseLogFilesPathValue + '\Edb*.jrs')
|
||||
$ExcludePathList += ($DatabaseLogFilesPathValue + '\Ntds.pat')
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose -Message 'No Active Directory transaction log files to exclude'
|
||||
}
|
||||
|
||||
# Exclude the files in the NTDS Working folder
|
||||
$DSAWorkingDir = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NTDS\Parameters'
|
||||
$DSAWorkingDirPath = ('Registry::' + $DSAWorkingDir)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $DSAWorkingDirPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramGetItemProperty = @{
|
||||
Path = $DSAWorkingDirPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$DSAWorkingDirValue = (Get-ItemProperty @paramGetItemProperty | Select-Object -ExpandProperty 'DSA Working Directory')
|
||||
|
||||
if ($DSAWorkingDirValue)
|
||||
{
|
||||
$ExcludePathList += ($DSAWorkingDirValue + '\Temp.edb')
|
||||
$ExcludePathList += ($DSAWorkingDirValue + '\Edb.chk')
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose -Message 'No NTDS Working folder to exclude'
|
||||
}
|
||||
#endregion AdExclusions
|
||||
|
||||
#region SysVolExclusions
|
||||
# Turn off scanning of SYSVOL files
|
||||
|
||||
# Turn off scanning of files in the File Replication Service (FRS) Working folder
|
||||
$SysVolWorkingDir = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NtFrs\Parameters'
|
||||
$SysVolWorkingDirPath = ('Registry::' + $SysVolWorkingDir)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $SysVolWorkingDirPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramGetItemProperty = @{
|
||||
Path = $SysVolWorkingDirPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$SysVolWorkingDirValue = (Get-ItemProperty @paramGetItemProperty | Select-Object -ExpandProperty 'Working Directory')
|
||||
if ($SysVolWorkingDirValue)
|
||||
{
|
||||
$ExcludePathList += ($SysVolWorkingDirValue + '\jet\sys\edb.chk')
|
||||
$ExcludePathList += ($SysVolWorkingDirValue + '\jet\Ntfrs.jdb')
|
||||
$ExcludePathList += ($SysVolWorkingDirValue + '\jet\log\*.log')
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose -Message 'No File Replication Service Working folder to exclude'
|
||||
}
|
||||
|
||||
# Turn off scanning of files in the File Replication Service Database Log files
|
||||
$SysVolDBLogFileDir = 'HKEY_LOCAL_MACHINE\SYSTEM\Currentcontrolset\Services\Ntfrs\Parameters'
|
||||
$SysVolDBLogFileDirPath = ('Registry::' + $SysVolDBLogFileDir)
|
||||
|
||||
if (Test-Path -Path $SysVolDBLogFileDirPath -ErrorAction $SCT)
|
||||
{
|
||||
$paramGetItemProperty = @{
|
||||
Path = $SysVolWorkingDirPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$SysVolDBLogFileDirValue = (Get-ItemProperty @paramGetItemProperty | Select-Object -ExpandProperty 'Working Directory')
|
||||
|
||||
if ($SysVolDBLogFileDirValue)
|
||||
{
|
||||
$ExcludePathList += ($SysVolDBLogFileDirValue + '\Jet\Log\Edb*.jrs')
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($SysVolWorkingDirValue)
|
||||
{
|
||||
$ExcludePathList += ($SysVolWorkingDirValue + '\jet\Log\Edb*.log')
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose -Message 'No File Replication Service Database Log files to exclude'
|
||||
}
|
||||
#endregion SysVolExclusions
|
||||
|
||||
#region DhcpExclusions
|
||||
# Turn off scanning of DHCP files
|
||||
$DhcpFiles = 'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\DHCPServer\Parameters'
|
||||
$DhcpFilesPath = ('Registry::' + $DhcpFiles)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $DhcpFilesPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramGetItemProperty = @{
|
||||
Path = $DhcpFilesPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$DhcpDatabasePathValue = (Get-ItemProperty @paramGetItemProperty | Select-Object -ExpandProperty 'DatabasePath')
|
||||
if ($DhcpDatabasePathValue)
|
||||
{
|
||||
$ExcludePathList += ($DhcpDatabasePathValue + '\*.mdb')
|
||||
$ExcludePathList += ($DhcpDatabasePathValue + '\*.pat')
|
||||
$ExcludePathList += ($DhcpDatabasePathValue + '\*.chk')
|
||||
$ExcludePathList += ($DhcpDatabasePathValue + '\*.edb')
|
||||
}
|
||||
|
||||
$paramGetItemProperty = @{
|
||||
Path = $DhcpFilesPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$DhcpLogFilePathValue = (Get-ItemProperty @paramGetItemProperty | Select-Object -ExpandProperty 'DhcpLogFilePath')
|
||||
|
||||
if (($DhcpLogFilePathValue) -and ($DhcpLogFilePathValue -ne $DhcpDatabasePathValue))
|
||||
{
|
||||
$ExcludePathList += ($DhcpLogFilePathValue + '\*.log')
|
||||
}
|
||||
else
|
||||
{
|
||||
$ExcludePathList += ($DhcpDatabasePathValue + '\*.log')
|
||||
}
|
||||
|
||||
$paramGetItemProperty = @{
|
||||
Path = $DhcpFilesPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
|
||||
$DhcpBackupDatabasePathValue = (Get-ItemProperty @paramGetItemProperty | Select-Object -ExpandProperty 'BackupDatabasePath')
|
||||
|
||||
if ($DhcpBackupDatabasePathValue)
|
||||
{
|
||||
$ExcludePathList += ($DhcpBackupDatabasePathValue + '\new\*.mdb')
|
||||
$ExcludePathList += ($DhcpBackupDatabasePathValue + '\new\*.pat')
|
||||
$ExcludePathList += ($DhcpBackupDatabasePathValue + '\new\*.chk')
|
||||
$ExcludePathList += ($DhcpBackupDatabasePathValue + '\new\*.edb')
|
||||
$ExcludePathList += ($DhcpBackupDatabasePathValue + '\new\*.log')
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose -Message 'No DHCP Server Directory found'
|
||||
}
|
||||
#endregion DhcpExclusions
|
||||
|
||||
#region DnsExclusions
|
||||
$DnsServerDir = "$env:windir\System32\dns"
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $DnsServerDir
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$ExcludePathList += ($DnsServerDir + '\*.log')
|
||||
$ExcludePathList += ($DnsServerDir + '\*.dns')
|
||||
$ExcludePathList += ($DnsServerDir + '\BOOT')
|
||||
|
||||
$DnsBackupServerDir = ($DnsServerDir + '\backup')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $DnsBackupServerDir
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$ExcludePathList += ($DnsBackupServerDir + '\*.log')
|
||||
$ExcludePathList += ($DnsBackupServerDir + '\*.dns')
|
||||
$ExcludePathList += ($DnsBackupServerDir + '\BOOT')
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose -Message 'No DNS Server Directory found'
|
||||
}
|
||||
#endregion DnsExclusions
|
||||
|
||||
#region WinsExclusions
|
||||
$WinsServerDir = "$env:windir\System32\Wins"
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $WinsServerDir
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
Write-Warning -Message 'WINS is still installed on this system!' -WarningAction Continue
|
||||
|
||||
$ExcludePathList += ($WinsServerDir + '\*.chk')
|
||||
$ExcludePathList += ($WinsServerDir + '\*.log')
|
||||
$ExcludePathList += ($WinsServerDir + '\*.mdb')
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose -Message 'No WINS Server Directory found'
|
||||
}
|
||||
#endregion WinsExclusions
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
if ($pscmdlet.ShouldProcess($ExcludePathList, 'Exclude from Microsoft Defender Scanning'))
|
||||
{
|
||||
# Loop over the list we created
|
||||
foreach ($ExcludePath in $ExcludePathList)
|
||||
{
|
||||
try
|
||||
{
|
||||
# Splat the parameters for Add-MpPreference
|
||||
$SplatAddMpPreference = @{
|
||||
ExclusionPath = $ExcludePath
|
||||
Force = $true
|
||||
ErrorAction = 'Stop'
|
||||
WarningAction = 'Continue'
|
||||
}
|
||||
$null = (Add-MpPreference @SplatAddMpPreference)
|
||||
}
|
||||
catch
|
||||
{
|
||||
#region ErrorHandler
|
||||
# get error record
|
||||
[Management.Automation.ErrorRecord]$e = $_
|
||||
|
||||
# retrieve information about runtime error
|
||||
$info = @{
|
||||
Exception = $e.Exception.Message
|
||||
Reason = $e.CategoryInfo.Reason
|
||||
Target = $e.CategoryInfo.TargetName
|
||||
Script = $e.InvocationInfo.ScriptName
|
||||
Line = $e.InvocationInfo.ScriptLineNumber
|
||||
Column = $e.InvocationInfo.OffsetInLine
|
||||
}
|
||||
|
||||
# Error Stack
|
||||
$info | Out-String | Write-Verbose
|
||||
|
||||
# Just display the info on continue with the rest of the list
|
||||
Write-Warning -Message ($info.Exception) -ErrorAction Continue -WarningAction Continue
|
||||
|
||||
# Cleanup
|
||||
$info = $null
|
||||
$e = $null
|
||||
#endregion ErrorHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($pscmdlet.ShouldProcess($ExcludePathList, 'Tweak Controlled Folder AccessAllowed Applications'))
|
||||
{
|
||||
$paramGetMpPreference = @{
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$CurrentAllowedApplications = ((Get-MpPreference @paramGetMpPreference).ControlledFolderAccessAllowedApplications)
|
||||
|
||||
# Prevent issues with missing allowed applications
|
||||
if (-not ($CurrentAllowedApplications))
|
||||
{
|
||||
# New installations might not have allowed applications, let us create an empty object
|
||||
$CurrentAllowedApplications = @()
|
||||
}
|
||||
|
||||
$AllowedApplications = @(
|
||||
'C:\Program Files (x86)\KeePass Password Safe 2\KeePass.exe'
|
||||
'C:\Program Files\Intel\Intel(R) Rapid Storage Technology\IAStorDataMgrSvc.exe'
|
||||
'C:\ProgramData\chocolatey\lib\vlc\tools\vlc-*-win64_x64.exe'
|
||||
'C:\swsetup\SP*\HPImageAssistant.dll'
|
||||
'C:\Users\*\AppData\Local\Programs\Mark Text\Mark Text.exe'
|
||||
'C:\Users\*\AppData\Local\Temp\chocolatey\is-*.tmp\WinSCP-*-Setup.tmp'
|
||||
'C:\Windows\explorer.exe'
|
||||
'C:\Windows\System32\svchost.exe'
|
||||
'C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe'
|
||||
)
|
||||
|
||||
$AllowedApplications | ForEach-Object -Process {
|
||||
if (-not ($CurrentAllowedApplications.Contains($_)))
|
||||
{
|
||||
# Not the fasted way, but this will work just fine
|
||||
$CurrentAllowedApplications += $_
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
# Apply the new (merged) allowed application list to the Defender Controlled Folder Access Allowed feature
|
||||
$paramAddMpPreference = @{
|
||||
ControlledFolderAccessAllowedApplications = $CurrentAllowedApplications
|
||||
Force = $true
|
||||
ErrorAction = 'Stop'
|
||||
}
|
||||
$null = (Add-MpPreference @paramAddMpPreference)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message 'Unable to modify the allow list...'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,15 @@
|
||||
#requires -Version 1.0
|
||||
|
||||
if (-not ($ComputerName))
|
||||
{
|
||||
$ComputerName = $Env:COMPUTERNAME
|
||||
}
|
||||
$paramGetWmiObject = @{
|
||||
Class = 'Win32_TSGeneralSetting'
|
||||
Namespace = 'root\cimv2\terminalservices'
|
||||
ComputerName = $ComputerName
|
||||
Filter = "TerminalName='RDP-tcp'"
|
||||
}
|
||||
$null = ((Get-WmiObject @paramGetWmiObject).SetUserAuthenticationRequired(0))
|
||||
|
||||
& "$env:windir\system32\net.exe" localgroup 'Remote Desktop Users' /add 'AzureAD\joerg@hochwald.net'
|
||||
@@ -0,0 +1,96 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes all public Desktop Links
|
||||
|
||||
.DESCRIPTION
|
||||
Removes all public Desktop Links
|
||||
|
||||
.NOTES
|
||||
Still beta!
|
||||
|
||||
Version 1.0.2
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Removes all public Desktop Links'
|
||||
|
||||
#region GlobalDefaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
# Wait a moment to make the command above work (Otherwise the delete might get blocked!!!)
|
||||
Start-Sleep -Seconds 5
|
||||
|
||||
$paramGetChildItem = @{
|
||||
Path = ($env:PUBLIC + '\Desktop\')
|
||||
Filter = '*.lnk'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
#endregion GlobalDefaults
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
if ($pscmdlet.ShouldProcess('All public Desktop Links', 'Remove'))
|
||||
{
|
||||
$null = (Get-ChildItem @paramGetChildItem | Select-Object -ExpandProperty FullName | Remove-Item @paramRemoveItem)
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,128 @@
|
||||
#requires -Version 3.0 -Modules CimCmdlets, Microsoft.PowerShell.LocalAccounts -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Remove given user and the matching profile
|
||||
|
||||
.DESCRIPTION
|
||||
Remove given user and the matching profile.
|
||||
Created to remove all inactive guest users on a shared device
|
||||
|
||||
.PARAMETER User
|
||||
You can specify the Username or use wildcards
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Remove-GuestUserAccounts.ps1 -User 'JohnDoe'
|
||||
|
||||
Remove the user named 'JohnDoe', it also removes the Profile of the User.
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Remove-GuestUserAccounts.ps1 -User 'enguest*'
|
||||
|
||||
Remove all users that starts with 'enguest', it also removes all Profiles of these Users.
|
||||
|
||||
.NOTES
|
||||
Created to cleanup a shared device in aa conference room.
|
||||
We run this script every day to save some diskspace and to delete all unneeded accounts.
|
||||
All guest accounts on this system are one time users, so they are disabled after each use anyway.
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param
|
||||
(
|
||||
[Parameter(ValueFromPipeline,
|
||||
ValueFromPipelineByPropertyName)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias('UserAlias')]
|
||||
[string]
|
||||
$User = 'shpctac*'
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
# Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
|
||||
# Cleanup
|
||||
$ExpiredGuests = $null
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
if ($pscmdlet.ShouldProcess($User, 'Delete'))
|
||||
{
|
||||
# Get all matching users
|
||||
$paramGetLocalUser = @{
|
||||
Name = $User
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$ExpiredGuests = (Get-LocalUser @paramGetLocalUser | Where-Object -FilterScript {
|
||||
$_.Enabled -eq $false
|
||||
})
|
||||
|
||||
# Delete matching users, if we have some
|
||||
if ($ExpiredGuests)
|
||||
{
|
||||
# Remove the User Account
|
||||
$ExpiredGuests | ForEach-Object -Process {
|
||||
$paramRemoveLocalUser = @{
|
||||
Name = ($_.Name)
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-LocalUser @paramRemoveLocalUser)
|
||||
}
|
||||
|
||||
# Remove the Profile
|
||||
$ExpiredGuests | ForEach-Object -Process {
|
||||
$paramGetCimInstance = @{
|
||||
ClassName = 'Win32_UserProfile'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$paramRemoveCimInstance = @{
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Get-CimInstance @paramGetCimInstance | Where-Object -FilterScript {
|
||||
$_.LocalPath.split('\') -eq $_.Name
|
||||
} | Remove-CimInstance @paramRemoveCimInstance)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,171 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Enable inbound ICMP (Ping) and Remote Desktop (RDP)
|
||||
|
||||
.DESCRIPTION
|
||||
Enable inbound ICMP (Ping) and Remote Desktop (RDP).
|
||||
Ping will be enabled for IPv4 and IPv6.
|
||||
|
||||
.PARAMETER RDPGroup
|
||||
Enable the complete RDP Groups in the Windows Firewall?
|
||||
This will enable more then just the basic requirements, use with care!!!
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Set-AllowPingAndRemoteDesktop.ps1
|
||||
|
||||
Enable inbound ICMP (Ping) and Remote Desktop (RDP)
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Set-AllowPingAndRemoteDesktop.ps1 -verbose
|
||||
|
||||
Enable inbound ICMP (Ping) and Remote Desktop (RDP) - verbose run
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Set-AllowPingAndRemoteDesktop.ps1 -WhatIf
|
||||
|
||||
Enable inbound ICMP (Ping) and Remote Desktop (RDP) - Dry run
|
||||
|
||||
.NOTES
|
||||
Helper script I use to bootstrap servers
|
||||
Run this elevated!!!
|
||||
|
||||
Version 1.0.4
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||
SupportsShouldProcess)]
|
||||
param
|
||||
(
|
||||
[Parameter(ValueFromPipeline)]
|
||||
[switch]
|
||||
$RDPGroup
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Enable inbound ICMP (Ping) and Remote Desktop (RDP)'
|
||||
|
||||
$SCT = 'SilentlyContinue'
|
||||
$CNT = 'Continue'
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
# Splat the Set-ItemProperty parameters
|
||||
$paramSetItemProperty = @{
|
||||
Path = 'HKLM:\System\CurrentControlSet\Control\Terminal Server'
|
||||
Name = 'fDenyTSConnections'
|
||||
Value = 0
|
||||
ErrorAction = $CNT
|
||||
}
|
||||
|
||||
# Splat the Enable-NetFirewallRule parameters
|
||||
$paramEnableNetFirewallRule = @{
|
||||
Confirm = $false
|
||||
ErrorAction = $CNT
|
||||
}
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Support WhatIf (SupportsShouldProcess)
|
||||
if ($pscmdlet.ShouldProcess('Registry Terminal Server', 'Modify'))
|
||||
{
|
||||
# Tweak the Registry for Remote Desktop connections
|
||||
$null = (Set-ItemProperty @paramSetItemProperty)
|
||||
}
|
||||
|
||||
# We avoid using $RDPGroup.IsPresent
|
||||
if ($PSBoundParameters.ContainsKey('RDPGroup'))
|
||||
{
|
||||
if ($pscmdlet.ShouldProcess('Firewall Group for Remote Desktop', 'Enable'))
|
||||
{
|
||||
# Allow Remote Desktop (The Group)
|
||||
$paramGetNetFirewallRule = @{
|
||||
DisplayGroup = 'Remote Desktop'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-NetFirewallRule @paramGetNetFirewallRule | Where-Object {
|
||||
$_.Enabled -ne $true
|
||||
} | Enable-NetFirewallRule @paramEnableNetFirewallRule)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($pscmdlet.ShouldProcess('Firewall Rules for Remote Desktop', 'Enable'))
|
||||
{
|
||||
# Alternative Approach: Enable the minimum, not the Group
|
||||
$paramGetNetFirewallRule = @{
|
||||
Name = 'RemoteDesktop-UserMode-In-TCP'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-NetFirewallRule @paramGetNetFirewallRule | Where-Object {
|
||||
$_.Enabled -ne $true
|
||||
} | Enable-NetFirewallRule @paramEnableNetFirewallRule)
|
||||
|
||||
$paramGetNetFirewallRule = @{
|
||||
DisplayName = 'Remote Desktop - User Mode (TCP-In)'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-NetFirewallRule @paramGetNetFirewallRule | Where-Object {
|
||||
$_.Enabled -ne $true
|
||||
} | Enable-NetFirewallRule @paramEnableNetFirewallRule)
|
||||
}
|
||||
}
|
||||
|
||||
if ($pscmdlet.ShouldProcess('Ping', 'Enable'))
|
||||
{
|
||||
# Allow Ping for IPv4 and IPv6
|
||||
# NOTE: The wildcard (ICMPv?) will select both. Replace it with 4 or 6 to use just one of them
|
||||
$paramGetNetFirewallRule = @{
|
||||
DisplayName = 'File and Printer Sharing (Echo Request - ICMPv?-In)'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-NetFirewallRule @paramGetNetFirewallRule | Where-Object {
|
||||
$_.Enabled -ne $true
|
||||
} | Enable-NetFirewallRule @paramEnableNetFirewallRule)
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,221 @@
|
||||
#requires -Version 2.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Configure the Windows 10 Start Menu
|
||||
|
||||
.DESCRIPTION
|
||||
Configure the Windows 10 Start Menu
|
||||
|
||||
.NOTES
|
||||
Version 1.0.3
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Configure the Windows 10 Start Menu'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
$StartMenuContent = @'
|
||||
<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
|
||||
<LayoutOptions StartTileGroupCellWidth="6" />
|
||||
<DefaultLayoutOverride>
|
||||
<StartLayoutCollection>
|
||||
<defaultlayout:StartLayout GroupCellWidth="6">
|
||||
<start:Group Name="Office">
|
||||
<start:DesktopApplicationTile Size="2x2" Column="4" Row="2" DesktopApplicationID="Microsoft.Office.POWERPNT.EXE.15" />
|
||||
<start:DesktopApplicationTile Size="2x2" Column="4" Row="0" DesktopApplicationID="com.squirrel.Teams.Teams" />
|
||||
<start:DesktopApplicationTile Size="2x2" Column="2" Row="2" DesktopApplicationID="Microsoft.Office.WINWORD.EXE.15" />
|
||||
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Office.OUTLOOK.EXE.15" />
|
||||
<start:DesktopApplicationTile Size="2x2" Column="0" Row="2" DesktopApplicationID="Microsoft.Office.EXCEL.EXE.15" />
|
||||
<start:Tile Size="2x2" Column="2" Row="0" AppUserModelID="Microsoft.Office.OneNote_8wekyb3d8bbwe!microsoft.onenoteim" />
|
||||
</start:Group>
|
||||
<start:Group Name="Misc">
|
||||
<start:DesktopApplicationTile Size="1x1" Column="0" Row="0" DesktopApplicationID="Microsoft.VisualStudioCode" />
|
||||
<start:DesktopApplicationTile Size="1x1" Column="1" Row="1" DesktopApplicationID="{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe" />
|
||||
<start:DesktopApplicationTile Size="1x1" Column="1" Row="0" DesktopApplicationID="{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\PowerShell_ISE.exe" />
|
||||
<start:DesktopApplicationTile Size="1x1" Column="3" Row="1" DesktopApplicationID="Microsoft.Windows.Computer" />
|
||||
<start:Tile Size="1x1" Column="0" Row="1" AppUserModelID="Microsoft.WindowsTerminal_8wekyb3d8bbwe!App" />
|
||||
<start:DesktopApplicationTile Size="1x1" Column="2" Row="1" DesktopApplicationID="MSEdge" />
|
||||
<start:Tile Size="1x1" Column="2" Row="0" AppUserModelID="Microsoft.WindowsStore_8wekyb3d8bbwe!App" />
|
||||
<start:DesktopApplicationTile Size="1x1" Column="3" Row="0" DesktopApplicationID="Microsoft.Windows.Explorer" />
|
||||
</start:Group>
|
||||
</defaultlayout:StartLayout>
|
||||
</StartLayoutCollection>
|
||||
</DefaultLayoutOverride>
|
||||
</LayoutModificationTemplate>
|
||||
'@
|
||||
|
||||
$StartMenuFile = "$env:windir\StartMenuLayout.xml"
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$null = (Get-Service -Name 'WSearch' -ErrorAction $SCT | Where-Object -FilterScript {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service -Force -Confirm:$false -ErrorAction $SCT)
|
||||
|
||||
# Delete layout file if it already exists
|
||||
$paramTestPath = @{
|
||||
Path = $StartMenuFile
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = $StartMenuFile
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
|
||||
# Creates the blank layout file
|
||||
$paramOutFile = @{
|
||||
FilePath = $StartMenuFile
|
||||
Encoding = 'ASCII'
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = ($StartMenuContent | Out-File @paramOutFile)
|
||||
|
||||
$RegistryAliases = @('HKLM', 'HKCU')
|
||||
|
||||
# Assign the start layout and force it to apply with "LockedStartLayout" at both the machine and user level
|
||||
foreach ($RegistryAlias in $RegistryAliases)
|
||||
{
|
||||
$RegistryBasePath = ($RegistryAlias + ':\SOFTWARE\Policies\Microsoft\Windows')
|
||||
$RegistryKeyPath = ($RegistryBasePath + '\Explorer')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $RegistryKeyPath
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
if (-not (Test-Path @paramTestPath))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = $RegistryBasePath
|
||||
Name = 'Explorer'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
$paramSetItemProperty = @{
|
||||
Path = $RegistryKeyPath
|
||||
Name = 'LockedStartLayout'
|
||||
Value = 1
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Set-ItemProperty @paramSetItemProperty)
|
||||
$paramSetItemProperty = @{
|
||||
Path = $RegistryKeyPath
|
||||
Name = 'StartLayoutFile'
|
||||
Value = $StartMenuFile
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Set-ItemProperty @paramSetItemProperty)
|
||||
}
|
||||
|
||||
# Restart Explorer, open the start menu (necessary to load the new layout)
|
||||
$null = (Stop-Process -Name explorer)
|
||||
|
||||
# Give it a few seconds to process
|
||||
Start-Sleep -Seconds 5
|
||||
|
||||
$paramNewObject = @{
|
||||
ComObject = 'wscript.shell'
|
||||
}
|
||||
$WScriptShell = (New-Object @paramNewObject)
|
||||
$WScriptShell.SendKeys('^{ESCAPE}')
|
||||
|
||||
# Give it a few seconds to process
|
||||
Start-Sleep -Seconds 5
|
||||
|
||||
# Enable the ability to pin items again by disabling "LockedStartLayout"
|
||||
foreach ($RegistryAlias in $RegistryAliases)
|
||||
{
|
||||
$RegistryBasePath = $RegistryAlias + ':\SOFTWARE\Policies\Microsoft\Windows'
|
||||
$RegistryKeyPath = $RegistryBasePath + '\Explorer'
|
||||
$paramSetItemProperty = @{
|
||||
Path = $RegistryKeyPath
|
||||
Name = 'LockedStartLayout'
|
||||
Value = 0
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Set-ItemProperty @paramSetItemProperty)
|
||||
}
|
||||
|
||||
# Restart Explorer and delete the layout file
|
||||
Stop-Process -Name explorer
|
||||
|
||||
# Uncomment the next line to make clean start menu default for all new users
|
||||
# Import-StartLayout -LayoutPath $layoutFile -MountPath $env:SystemDrive\
|
||||
$paramRemoveItem = @{
|
||||
Path = $StartMenuFile
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,192 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Set the Windows Power Plan based on the computer type
|
||||
|
||||
.DESCRIPTION
|
||||
Set the Windows Power Plan based on the computer type, it also set the Hibernation
|
||||
With Version 1.1 we introduced Support for the Parallels Power Schema
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Set-PowerPlanToAuto.ps1
|
||||
|
||||
.NOTES
|
||||
|
||||
Version 1.1.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Set the Windows Power Plan to Auto'
|
||||
|
||||
#region
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion
|
||||
|
||||
#region
|
||||
$paramGetWmiObject = @{
|
||||
Namespace = 'root\cimv2\power'
|
||||
Class = 'Win32_PowerPlan'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region
|
||||
function Get-ActiveWindowsPowerPlan
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Get the active Windows Power Plan
|
||||
|
||||
.DESCRIPTION
|
||||
Get the active Windows Power Plan
|
||||
|
||||
.PARAMETER AllPowerPlans
|
||||
All Power Plans that Windows knows about
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Get-ActiveWindowsPowerPlan
|
||||
|
||||
.NOTES
|
||||
Internal Helper
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'None')]
|
||||
[OutputType([string])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory,
|
||||
ValueFromPipeline,
|
||||
ValueFromPipelineByPropertyName,
|
||||
Position = 0,
|
||||
HelpMessage = 'Object with all Power Plans')]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[psobject]
|
||||
$AllPowerPlans
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
#region
|
||||
$ActivePowerPlan = $null
|
||||
#endregion
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
#$AllPowerPlans = (Get-WmiObject @paramGetWmiObject | Select-Object -Property ElementName, InstanceID, IsActive)
|
||||
$ActivePowerPlan = ($AllPowerPlans | Where-Object -FilterScript {
|
||||
$_.IsActive -eq $true
|
||||
} | Select-Object -ExpandProperty ElementName)
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
$ActivePowerPlan
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Get all Power Plans
|
||||
$AllPowerPlans = (Get-WmiObject @paramGetWmiObject | Select-Object -Property ElementName, InstanceID, IsActive)
|
||||
|
||||
# Get the active Power Plan
|
||||
$ActivePowerPlan = (Get-ActiveWindowsPowerPlan -AllPowerPlans $AllPowerPlans -ErrorAction $SCT)
|
||||
|
||||
Write-Verbose -Message ('Active Power Plan: {0}' -f $ActivePowerPlan)
|
||||
|
||||
if ((($AllPowerPlans).ElementName) -ccontains 'Parallels')
|
||||
{
|
||||
# Looks like this system is a VM on Parallels
|
||||
$RunOnParallels = ($AllPowerPlans | Where-Object {
|
||||
$_.ElementName -ccontains 'Parallels'
|
||||
} | Select-Object -ExpandProperty InstanceID)
|
||||
|
||||
# Extract the ID of the Power Schema
|
||||
$RunOnParallels = ([Regex]::Matches($RunOnParallels, '(?<={)(.*?)(?=})') | Select-Object -ExpandProperty Value)
|
||||
|
||||
# Activate the Parallels Schema
|
||||
$null = (& "$env:windir\system32\powercfg.exe" /SETACTIVE $RunOnParallels)
|
||||
|
||||
# Disable Hybernation
|
||||
$null = (& "$env:windir\system32\powercfg.exe" /HIBERNATE OFF)
|
||||
}
|
||||
elseif ((Get-CimInstance -ClassName Win32_ComputerSystem -ErrorAction $SCT).PCSystemType -eq 2)
|
||||
{
|
||||
# Balanced for laptop
|
||||
$null = (& "$env:windir\system32\powercfg.exe" /SETACTIVE SCHEME_BALANCED)
|
||||
|
||||
# Enable Hybernation
|
||||
$null = (& "$env:windir\system32\powercfg.exe" /HIBERNATE ON)
|
||||
}
|
||||
else
|
||||
{
|
||||
# High performance for desktop
|
||||
$null = (& "$env:windir\system32\powercfg.exe" /SETACTIVE SCHEME_MIN)
|
||||
|
||||
# Disable Hybernation
|
||||
$null = (& "$env:windir\system32\powercfg.exe" /HIBERNATE OFF)
|
||||
}
|
||||
|
||||
# Get all Power Plans
|
||||
$AllPowerPlans = (Get-WmiObject @paramGetWmiObject | Select-Object -Property ElementName, InstanceID, IsActive)
|
||||
|
||||
# Get the active Power Plan
|
||||
$ActivePowerPlan = (Get-ActiveWindowsPowerPlan -AllPowerPlans $AllPowerPlans -ErrorAction $SCT)
|
||||
|
||||
Write-Verbose -Message ('Active Power Plan: {0}' -f $ActivePowerPlan)
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
#region
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,138 @@
|
||||
#requires -Version 2.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Set the Windows Power Plan to High Performance
|
||||
|
||||
.DESCRIPTION
|
||||
Set the Windows Power Plan to High Performance, it also disables Hybernation and System Standby
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Set-PowerPlanToHighPerformance.ps1
|
||||
|
||||
.NOTES
|
||||
Works fine on Windows Server 2016 (Developed for server use) and Windows 10.
|
||||
|
||||
Version 1.5.9
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Set the Windows Power Plan to High Performance'
|
||||
|
||||
$SCT = 'SilentlyContinue'
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$null = (Get-Service -Name 'WSearch' -ErrorAction $SCT | Where-Object -FilterScript {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service -Force -Confirm:$false -ErrorAction $SCT)
|
||||
|
||||
#region
|
||||
$null = (& "$env:windir\system32\powercfg.exe" /SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c)
|
||||
#endregion
|
||||
|
||||
#region Cleanup
|
||||
$ActivePowerPlan = $null
|
||||
$PowerPlanHighPowerState = $null
|
||||
#endregion Cleanup
|
||||
|
||||
#region InformationGathering
|
||||
# Splat the parameters
|
||||
$paramGetWmiObject = @{
|
||||
Namespace = 'root\cimv2\power'
|
||||
Class = 'Win32_PowerPlan'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
|
||||
# Gather the PowerPlan information
|
||||
$ActivePowerPlan = (Get-WmiObject @paramGetWmiObject | Select-Object -Property ElementName, InstanceID, IsActive)
|
||||
|
||||
# Filter the 'High Performance' plan info
|
||||
$PowerPlanHighPowerState = $ActivePowerPlan | Where-Object -FilterScript {
|
||||
$_.InstanceID -eq 'Microsoft:PowerPlan\{8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c}'
|
||||
}
|
||||
#endregion InformationGathering
|
||||
|
||||
#region CheckIfTheTweakIsNeeded
|
||||
if ($PowerPlanHighPowerState.IsActive -ne $true)
|
||||
{
|
||||
$null = (& "$env:windir\system32\powercfg.exe" /SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c)
|
||||
$null = (& "$env:windir\system32\powercfg.exe" /SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c)
|
||||
}
|
||||
#endregion CheckIfTheTweakIsNeeded
|
||||
|
||||
#region Cleanup
|
||||
$PowerPlanHighPowerState = $null
|
||||
#endregion Cleanup
|
||||
|
||||
#region Retest
|
||||
$PowerPlanHighPowerState = $ActivePowerPlan | Where-Object -FilterScript {
|
||||
$_.InstanceID -eq 'Microsoft:PowerPlan\{8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c}'
|
||||
}
|
||||
|
||||
# Filter the 'High Performance' plan info
|
||||
if ($PowerPlanHighPowerState.IsActive -ne $true)
|
||||
{
|
||||
Write-Warning -Message "Unable to set the PowerPlan to 'High Performance'"
|
||||
}
|
||||
#endregion Retest
|
||||
|
||||
#region NoStandBy
|
||||
$null = (& "$env:windir\system32\powercfg.exe" -change -standby-timeout-ac 0)
|
||||
#endregion NoStandBy
|
||||
|
||||
#region DisableHybernationSupport
|
||||
$null = (& "$env:windir\system32\powercfg.exe" /HIBERNATE OFF)
|
||||
$null = (& "$env:windir\system32\powercfg.exe" -change -hibernate-timeout-ac 0)
|
||||
#endregion DisableHybernationSupport
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,223 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Apply QoS Settings for Microsoft Teams
|
||||
|
||||
.DESCRIPTION
|
||||
Apply Network Quality of Service (QoS) settings for Microsoft Teams.
|
||||
|
||||
.PARAMETER AppPathNameMatchCondition
|
||||
Specifies the name by which an application is run, such as application.exe or %ProgramFiles%\application.exe application.
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Set-QoSForMicrosoftTeams.ps1
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Set-QoSForMicrosoftTeamsRoom.ps1 -AppPathNameMatchCondition 'Teams.exe'
|
||||
|
||||
.NOTES
|
||||
Changelog:
|
||||
1.0.0: Initial Release (Adopted from Set-QoSForMicrosoftTeamsRoomDevices.ps1)
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
Get-NetQosPolicy
|
||||
|
||||
.LINK
|
||||
New-NetQosPolicy
|
||||
|
||||
.LINK
|
||||
https://docs.microsoft.com/en-us/microsoftteams/qos-in-teams-clients
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param
|
||||
(
|
||||
[Parameter(ValueFromPipeline,
|
||||
ValueFromPipelineByPropertyName)]
|
||||
[Alias('AppName')]
|
||||
[string]
|
||||
$AppPathNameMatchCondition = 'Teams.exe'
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Apply Network Quality of Service (QoS) settings for Microsoft Teams'
|
||||
|
||||
#region Defaults
|
||||
$CNT = 'Continue'
|
||||
$STP = 'Stop'
|
||||
$SCT = 'SilentlyContinue'
|
||||
|
||||
[string]$AppSharingPolicy = 'Microsoft Teams AppSharing'
|
||||
[string]$VideoPolicy = 'Microsoft Teams Video'
|
||||
[string]$AudioPoliy = 'Microsoft Teams Audio'
|
||||
#endregion Defaults
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
if ($pscmdlet.ShouldProcess('QoS-Settings', 'Apply'))
|
||||
{
|
||||
#region Audio
|
||||
$paramGetNetQosPolicy = @{
|
||||
Name = $AudioPoliy
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not (Get-NetQosPolicy @paramGetNetQosPolicy))
|
||||
{
|
||||
try
|
||||
{
|
||||
# Splat the parameters
|
||||
$paramNewNetQosPolicy = @{
|
||||
NetworkProfile = 'All'
|
||||
IPSrcPortStartMatchCondition = 50000
|
||||
IPSrcPortEndMatchCondition = 50019
|
||||
DSCPAction = 46
|
||||
IPProtocolMatchCondition = 'Both'
|
||||
Name = $AudioPoliy
|
||||
Confirm = $false
|
||||
WarningAction = $CNT
|
||||
ErrorAction = $STP
|
||||
}
|
||||
|
||||
# Do we have an application name?
|
||||
if ($AppPathNameMatchCondition)
|
||||
{
|
||||
$paramNewNetQosPolicy.Add('AppPathNameMatchCondition', $AppPathNameMatchCondition)
|
||||
}
|
||||
|
||||
$null = (New-NetQosPolicy @paramNewNetQosPolicy)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ('Unable to apply {0} QoS Poliy' -f $AudioPoliy)
|
||||
}
|
||||
}
|
||||
#endregion Audio
|
||||
|
||||
#region Video
|
||||
$paramGetNetQosPolicy = @{
|
||||
Name = $VideoPolicy
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not (Get-NetQosPolicy @paramGetNetQosPolicy))
|
||||
{
|
||||
try
|
||||
{
|
||||
# Splat the parameters
|
||||
$paramNewNetQosPolicy = @{
|
||||
NetworkProfile = 'All'
|
||||
IPSrcPortStartMatchCondition = 50020
|
||||
IPSrcPortEndMatchCondition = 50039
|
||||
DSCPAction = 34
|
||||
IPProtocolMatchCondition = 'Both'
|
||||
Name = $VideoPolicy
|
||||
Confirm = $false
|
||||
WarningAction = $CNT
|
||||
ErrorAction = $STP
|
||||
}
|
||||
|
||||
# Do we have an application name?
|
||||
if ($AppPathNameMatchCondition)
|
||||
{
|
||||
$paramNewNetQosPolicy.Add('AppPathNameMatchCondition', $AppPathNameMatchCondition)
|
||||
}
|
||||
|
||||
$null = (New-NetQosPolicy @paramNewNetQosPolicy)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ('Unable to apply {0} QoS Poliy' -f $VideoPolicy)
|
||||
}
|
||||
}
|
||||
#endregion Video
|
||||
|
||||
#region AppSharing
|
||||
$paramGetNetQosPolicy = @{
|
||||
Name = $AppSharingPolicy
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not (Get-NetQosPolicy @paramGetNetQosPolicy))
|
||||
{
|
||||
try
|
||||
{
|
||||
# Splat the parameters
|
||||
$paramNewNetQosPolicy = @{
|
||||
NetworkProfile = 'All'
|
||||
IPSrcPortStartMatchCondition = 50040
|
||||
IPSrcPortEndMatchCondition = 50059
|
||||
DSCPAction = 28
|
||||
IPProtocolMatchCondition = 'Both'
|
||||
Name = $AppSharingPolicy
|
||||
Confirm = $false
|
||||
WarningAction = $CNT
|
||||
ErrorAction = $STP
|
||||
}
|
||||
|
||||
# Do we have an application name?
|
||||
if ($AppPathNameMatchCondition)
|
||||
{
|
||||
$paramNewNetQosPolicy.Add('AppPathNameMatchCondition', $AppPathNameMatchCondition)
|
||||
}
|
||||
|
||||
$null = (New-NetQosPolicy @paramNewNetQosPolicy)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ('Unable to apply {0} QoS Poliy' -f $AppSharingPolicy)
|
||||
}
|
||||
}
|
||||
#endregion AppSharing
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,289 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Configure Storage Sense for Windows 10
|
||||
|
||||
.DESCRIPTION
|
||||
Configure Storage Sense for Windows 10
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Set-StorageSense.ps1
|
||||
|
||||
.NOTES
|
||||
Version 1.0.3
|
||||
|
||||
Use Set-StorageSense Version 1.0 from Jaap Brasser
|
||||
|
||||
.LINK
|
||||
https://github.com/jaapbrasser/SharedScripts/blob/master/Set-StorageSense/Set-StorageSense.ps1
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'None')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Configure Storage Sense for Windows 10'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
#endregion Defaults
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
function Set-StorageSense
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Configures the Storage Sense options in Windows 10
|
||||
|
||||
.DESCRIPTION
|
||||
This function can configure Storage Sense options in Windows 10. It allows to enable/disable this feature
|
||||
|
||||
.PARAMETER EnableStorageSense
|
||||
Enables storage sense setting, automatically cleaning up space on your system
|
||||
|
||||
.PARAMETER DisableStorageSense
|
||||
Disables storage sense setting, not automatically cleaning up space on your system
|
||||
|
||||
.PARAMETER RemoveAppFiles
|
||||
Configures the 'Delete temporary files that my apps aren't using' to either true or false
|
||||
|
||||
.PARAMETER ClearRecycleBin
|
||||
Configures the 'Delete files that have been in the recycle bin for over 30 days' to either true or false
|
||||
|
||||
.NOTES
|
||||
Name: Set-StorageSense
|
||||
Author: Jaap Brasser
|
||||
DateCreated: 2017-01-26
|
||||
DateUpdated: 2017-01-26
|
||||
Version: 1.0.0
|
||||
Blog: http://www.jaapbrasser.com
|
||||
|
||||
.LINK
|
||||
http://www.jaapbrasser.com
|
||||
|
||||
.EXAMPLE
|
||||
Set-StorageSense -DisableStorageSense
|
||||
|
||||
Description
|
||||
-----------
|
||||
Disables Storage Sense on the system
|
||||
|
||||
.EXAMPLE
|
||||
Set-StorageSense -EnableStorageSense -RemoveAppFiles $true
|
||||
|
||||
Description
|
||||
-----------
|
||||
Enables Storage Sense on the system and sets the 'Delete temporary files that my apps aren't using' to enabled
|
||||
|
||||
.EXAMPLE
|
||||
Set-StorageSense -DisableStorageSense -RemoveAppFiles $true -ClearRecycleBin $true -Verbose
|
||||
|
||||
Description
|
||||
-----------
|
||||
Disables Storage Sense on the system and sets both the 'Delete temporary files that my apps aren't using' and the 'Delete files that have been in the recycle bin for over 30 days' to enabled
|
||||
#>
|
||||
[cmdletbinding(SupportsShouldProcess)]
|
||||
param (
|
||||
[Parameter(
|
||||
Mandatory, HelpMessage = 'Add help message for user',
|
||||
ParameterSetName = 'StorageSense On'
|
||||
)]
|
||||
[switch]
|
||||
$EnableStorageSense,
|
||||
[Parameter(
|
||||
Mandatory, HelpMessage = 'Add help message for user',
|
||||
ParameterSetName = 'StorageSense Off'
|
||||
)]
|
||||
[switch]
|
||||
$DisableStorageSense,
|
||||
[Parameter(
|
||||
ParameterSetName = 'StorageSense On'
|
||||
)]
|
||||
[Parameter(
|
||||
ParameterSetName = 'StorageSense Off'
|
||||
)]
|
||||
[Parameter(
|
||||
ParameterSetName = 'Configure StorageSense'
|
||||
)]
|
||||
[bool]
|
||||
$RemoveAppFiles,
|
||||
[Parameter(
|
||||
ParameterSetName = 'StorageSense On'
|
||||
)]
|
||||
[Parameter(
|
||||
ParameterSetName = 'StorageSense Off'
|
||||
)]
|
||||
[Parameter(
|
||||
ParameterSetName = 'Configure StorageSense'
|
||||
)]
|
||||
[bool]
|
||||
$ClearRecycleBin
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
$RegPath = @{
|
||||
StorageSense = '01'
|
||||
TemporaryApp = '04'
|
||||
RecycleBin = '08'
|
||||
}
|
||||
$SetRegistrySplat = @{
|
||||
Path = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy\'
|
||||
Name = $null
|
||||
Value = $null
|
||||
}
|
||||
|
||||
function Set-RegistryValue
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Describe purpose of "Set-RegistryValue" in 1-2 sentences.
|
||||
|
||||
.DESCRIPTION
|
||||
Add a more complete description of what the function does.
|
||||
|
||||
.PARAMETER Path
|
||||
Describe parameter -Path.
|
||||
|
||||
.PARAMETER Name
|
||||
Describe parameter -Name.
|
||||
|
||||
.PARAMETER Value
|
||||
Describe parameter -Value.
|
||||
|
||||
.EXAMPLE
|
||||
Set-RegistryValue -Path Value -Name Value -Value Value
|
||||
Describe what this call does
|
||||
|
||||
.NOTES
|
||||
Place additional notes here.
|
||||
|
||||
.LINK
|
||||
URLs to related sites
|
||||
The first link is opened by Get-Help -Online Set-RegistryValue
|
||||
|
||||
.INPUTS
|
||||
List of input types that are accepted by this function.
|
||||
|
||||
.OUTPUTS
|
||||
List of output types produced by this function.
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[string]
|
||||
$Path,
|
||||
[string]
|
||||
$Name,
|
||||
[string]
|
||||
$Value
|
||||
)
|
||||
|
||||
if (-not (Test-Path -Path $Path -ErrorAction SilentlyContinue))
|
||||
{
|
||||
if ($PSCmdlet.ShouldProcess("$Path$Name : $Value", 'Creating registry key'))
|
||||
{
|
||||
$null = New-Item -Path $Path -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
if ($PSCmdlet.ShouldProcess("$Path$Name : $Value", 'Updating registry value'))
|
||||
{
|
||||
$null = Set-ItemProperty @PSBoundParameters -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
switch (1)
|
||||
{
|
||||
{
|
||||
$PSCmdlet.ParameterSetName -eq 'StorageSense On'
|
||||
}
|
||||
{
|
||||
$SetRegistrySplat.Name = $RegPath.StorageSense
|
||||
$SetRegistrySplat.Value = 1
|
||||
Set-RegistryValue @SetRegistrySplat
|
||||
}
|
||||
{
|
||||
$PSCmdlet.ParameterSetName -eq 'StorageSense Off'
|
||||
}
|
||||
{
|
||||
$SetRegistrySplat.Name = $RegPath.StorageSense
|
||||
$SetRegistrySplat.Value = 0
|
||||
Set-RegistryValue @SetRegistrySplat
|
||||
}
|
||||
{
|
||||
$PSBoundParameters.Keys -contains 'RemoveAppFiles'
|
||||
}
|
||||
{
|
||||
$SetRegistrySplat.Name = $RegPath.TemporaryApp
|
||||
$SetRegistrySplat.Value = [int]$RemoveAppFiles
|
||||
Set-RegistryValue @SetRegistrySplat
|
||||
}
|
||||
{
|
||||
$PSBoundParameters.Keys -contains 'ClearRecycleBin'
|
||||
}
|
||||
{
|
||||
$SetRegistrySplat.Name = $RegPath.RecycleBin
|
||||
$SetRegistrySplat.Value = [int]$ClearRecycleBin
|
||||
Set-RegistryValue @SetRegistrySplat
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
$paramSetStorageSense = @{
|
||||
EnableStorageSense = $true
|
||||
RemoveAppFiles = $true
|
||||
ClearRecycleBin = $true
|
||||
Verbose = $true
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Set-StorageSense @paramSetStorageSense)
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,841 @@
|
||||
#requires -Version 1.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Setup the default enaTec Start Menu for the System
|
||||
|
||||
.DESCRIPTION
|
||||
Setup the default enaTec Start Menu for the System
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Set-SystemStartMenuDefault.ps1
|
||||
|
||||
.NOTES
|
||||
Minor Helper
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'None')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Setup the default enaTec Start Menu for the System'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
$BasePath = "$env:ProgramData\Microsoft\Windows\Start Menu\Programs"
|
||||
#endregion Defaults
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
#region 7Zip
|
||||
$FolderName = '\7-Zip'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = ($FolderPath + '\7-Zip File Manager.lnk')
|
||||
Destination = $BasePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion 7Zip
|
||||
|
||||
#region Barco
|
||||
$FolderName = '\Barco'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = ($FolderPath + '\ClickShare.lnk')
|
||||
Destination = $BasePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
|
||||
$ClickShareLauncher = ($FolderPath + '\ClickShare Launcher\ClickShare Launcher.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $ClickShareLauncher
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = $ClickShareLauncher
|
||||
Destination = $BasePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
}
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion Barco
|
||||
|
||||
#region CMake
|
||||
$FolderName = '\CMake'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = ($FolderPath + '\CMake (cmake-gui).lnk')
|
||||
Destination = $BasePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion CMake
|
||||
|
||||
#region Cyberduck
|
||||
$FolderName = '\Cyberduck'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = ($FolderPath + '\Cyberduck.lnk')
|
||||
Destination = $BasePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion Cyberduck
|
||||
|
||||
#region Git
|
||||
$FolderName = '\Git'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = ($FolderPath + '\Git GUI.lnk')
|
||||
Destination = $BasePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion Git
|
||||
|
||||
#region HPHelpAndSupport
|
||||
$FolderName = '\HP Help and Support'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = ($FolderPath + '\HP Support Assistant.lnk')
|
||||
Destination = $BasePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion HPHelpAndSupport
|
||||
|
||||
#region KeePassXC
|
||||
$FolderName = '\KeePassXC'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = ($FolderPath + '\KeePassXC.lnk')
|
||||
Destination = $BasePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion KeePassXC
|
||||
|
||||
#region LockHunter
|
||||
$FolderName = '\LockHunter'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = ($FolderPath + '\LockHunter.lnk')
|
||||
Destination = $BasePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion LockHunter
|
||||
|
||||
#region MicrosoftIntuneManagementExtension
|
||||
$FolderName = '\Microsoft Intune Management Extension'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion MicrosoftIntuneManagementExtension
|
||||
|
||||
#region MicrosoftSilverlight
|
||||
$FolderName = '\Microsoft Silverlight'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion MicrosoftSilverlight
|
||||
|
||||
#region Python
|
||||
$FolderName = '\Python 3.9'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion Python
|
||||
|
||||
#region Node.js
|
||||
$FolderName = '\Node.js'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = ($FolderPath + '\Node.js.lnk')
|
||||
Destination = $BasePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion Node.js
|
||||
|
||||
#region VideoLAN
|
||||
$FolderName = '\VideoLAN'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = ($FolderPath + '\VLC media player.lnk')
|
||||
Destination = $BasePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion VideoLAN
|
||||
|
||||
#region WinMerge
|
||||
$FolderName = '\WinMerge'
|
||||
$FolderPath = ($BasePath + $FolderName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FolderPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = ($FolderPath + '\WinMerge.lnk')
|
||||
Destination = $BasePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = $FolderPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion WinMerge
|
||||
|
||||
#region Yubico
|
||||
$Yubico = '\Yubico'
|
||||
$YubicoPath = ($BasePath + $Yubico)
|
||||
$YubicoAuthenticator = '\Yubico Authenticator'
|
||||
$YubicoAuthenticatorPath = ($BasePath + $YubicoAuthenticator)
|
||||
|
||||
$paramTestYubicoPath = @{
|
||||
Path = $YubicoPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$paramTestYubicoAuthenticatorPath = @{
|
||||
Path = $YubicoAuthenticatorPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if ((Test-Path @paramTestYubicoPath ) -and (Test-Path @paramTestYubicoAuthenticatorPath))
|
||||
{
|
||||
# Move the Yubico Authenticator to the Yubico directory
|
||||
$paramMoveItem = @{
|
||||
Path = $YubicoAuthenticatorPath
|
||||
Destination = $YubicoPath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
|
||||
# Remove some links
|
||||
$paramRemoveItem = @{
|
||||
Path = ($YubicoPath + '\Yubikey Manager\Uninstall YubiKey Manager.lnk')
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = ($YubicoPath + '\YubiKey Personalization Tool\Uninstall.lnk')
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = ($YubicoPath + '\YubiKey Personalization Tool\Yubico Web page.url')
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = ($YubicoPath + '\YubiKey PIV Manager\Uninstall YubiKey PIV Manager.lnk')
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion Yubico
|
||||
|
||||
#region Structure
|
||||
#region Dev
|
||||
$RegionName = 'Dev'
|
||||
$RegionNamePath = ($BasePath + '\' + $RegionName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $RegionNamePath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not ((Test-Path @paramTestPath)))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = ($BasePath)
|
||||
Name = $RegionName
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
$MoveItems = @(
|
||||
'CMake (cmake-gui)'
|
||||
'Git GUI'
|
||||
'Node.js'
|
||||
'WinMerge'
|
||||
)
|
||||
|
||||
foreach ($MoveItem in $MoveItems)
|
||||
{
|
||||
$MoveItemPath = ($BasePath + '\' + $MoveItem + '.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $MoveItemPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $MoveItemPath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
}
|
||||
#endregion Dev
|
||||
|
||||
#region Tools
|
||||
$RegionName = 'Tools'
|
||||
$RegionNamePath = ($BasePath + '\' + $RegionName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $RegionNamePath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not ((Test-Path @paramTestPath)))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = ($BasePath)
|
||||
Name = $RegionName
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
$MoveItems = @(
|
||||
'7-Zip File Manager'
|
||||
'Chocolatey Cleaner'
|
||||
'Chocolatey GUI'
|
||||
'ClickShare Launcher'
|
||||
'ClickShare'
|
||||
'Cyberduck'
|
||||
'KeePass 2'
|
||||
'KeePassXC'
|
||||
'LockHunter'
|
||||
'Make Me Admin'
|
||||
'paint.net'
|
||||
'PowerToys (Preview)'
|
||||
'VLC media player'
|
||||
'WinSCP'
|
||||
)
|
||||
|
||||
foreach ($MoveItem in $MoveItems)
|
||||
{
|
||||
$MoveItemPath = ($BasePath + '\' + $MoveItem + '.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $MoveItemPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $MoveItemPath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
}
|
||||
#endregion Tools
|
||||
|
||||
#region Browser
|
||||
$RegionName = 'Browser'
|
||||
$RegionNamePath = ($BasePath + '\' + $RegionName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $RegionNamePath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not ((Test-Path @paramTestPath)))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = ($BasePath)
|
||||
Name = $RegionName
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
$MoveItems = @(
|
||||
'Chromium'
|
||||
'Firefox'
|
||||
'Google Chrome'
|
||||
'Microsoft Edge Beta'
|
||||
'Microsoft Edge'
|
||||
)
|
||||
|
||||
foreach ($MoveItem in $MoveItems)
|
||||
{
|
||||
$MoveItemPath = ($BasePath + '\' + $MoveItem + '.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $MoveItemPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $MoveItemPath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
}
|
||||
#endregion Browser
|
||||
|
||||
#region Office
|
||||
$RegionName = 'Microsoft Office'
|
||||
$RegionNamePath = ($BasePath + '\' + $RegionName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $RegionNamePath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not ((Test-Path @paramTestPath)))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = ($BasePath)
|
||||
Name = $RegionName
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
$MoveItems = @(
|
||||
'Excel'
|
||||
'OneNote 2016'
|
||||
'Outlook'
|
||||
'PowerPoint'
|
||||
'Project'
|
||||
'Visio'
|
||||
'Word'
|
||||
)
|
||||
|
||||
foreach ($MoveItem in $MoveItems)
|
||||
{
|
||||
$MoveItemPath = ($BasePath + '\' + $MoveItem + '.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $MoveItemPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $MoveItemPath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
}
|
||||
#endregion Office
|
||||
#endregion Structure
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
exit (0)
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,536 @@
|
||||
#requires -Version 1.0
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Setup the default enaTec Start Menu for the User
|
||||
|
||||
.DESCRIPTION
|
||||
Setup the default enaTec Start Menu for the User
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> .\Set-UserStartMenuDefault.ps1
|
||||
|
||||
.NOTES
|
||||
Minor Helper
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'None')]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Setup the default enaTec Start Menu for the User'
|
||||
|
||||
#region Defaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
$BasePath = ("$env:HOMEDRIVE\Users\" + $env:USERNAME + '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\')
|
||||
#endregion Defaults
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
#region Structure
|
||||
#region Dev
|
||||
$RegionName = 'Dev'
|
||||
$RegionNamePath = ($BasePath + '\' + $RegionName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $RegionNamePath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not ((Test-Path @paramTestPath)))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = ($BasePath)
|
||||
Name = $RegionName
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
#region Fiddler
|
||||
$FiddlerPath = ($BasePath + '\Fiddler 4.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FiddlerPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $FiddlerPath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
|
||||
$FiddlerScriptEditorPath = ($BasePath + '\Fiddler ScriptEditor.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $FiddlerScriptEditorPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $FiddlerScriptEditorPath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
#endregion Fiddler
|
||||
|
||||
#region GitHubInc
|
||||
$GitHubIncPath = ($BasePath + '\GitHub, Inc\GitHub Desktop.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $GitHubIncPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $GitHubIncPath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
|
||||
$GitHubIncPath = ($BasePath + '\GitHub, Inc\')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $GitHubIncPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = $GitHubIncPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion GitHubInc
|
||||
|
||||
#region Postman
|
||||
$PostmanPath = ($BasePath + '\Postman\Postman.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $PostmanPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $PostmanPath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
|
||||
$PostmanPath = ($BasePath + '\Postman')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $PostmanPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = $PostmanPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion Postman
|
||||
|
||||
#region MarkPad
|
||||
$MarkPadPath = ($BasePath + '\MarkPad\MarkPad.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $MarkPadPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $MarkPadPath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
|
||||
$MarkPadPath = ($BasePath + '\MarkPad')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $MarkPadPath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = $MarkPadPath
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion MarkPad
|
||||
#endregion Dev
|
||||
|
||||
#region Tools
|
||||
$RegionName = 'Tools'
|
||||
$RegionNamePath = ($BasePath + '\' + $RegionName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $RegionNamePath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not ((Test-Path @paramTestPath)))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = ($BasePath)
|
||||
Name = $RegionName
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
#region AutoDarkMode
|
||||
$AutoDarkModePath = ($BasePath + '\Auto Dark Mode.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $AutoDarkModePath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $AutoDarkModePath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
#endregion AutoDarkMode
|
||||
|
||||
#region MarkText
|
||||
$MarkTextPath = ($BasePath + '\Mark Text.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $MarkTextPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $MarkTextPath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
#endregion MarkText
|
||||
|
||||
#region Graphviz
|
||||
$paramGetItem = @{
|
||||
Path = ($BasePath + '\Graphviz*')
|
||||
Force = $true
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$GraphvizBasePath = (Get-Item @paramGetItem | Select-Object -ExpandProperty Name)
|
||||
|
||||
if ($GraphvizBasePath)
|
||||
{
|
||||
$paramTestPath = @{
|
||||
Path = ($BasePath + '\' + $GraphvizBasePath + '\gvedit.exe.lnk')
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramCopyItem = @{
|
||||
Path = ($BasePath + '\' + $GraphvizBasePath + '\gvedit.exe.lnk')
|
||||
Destination = ($RegionNamePath + '\Graphviz.lnk')
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Copy-Item @paramCopyItem)
|
||||
}
|
||||
|
||||
$paramRemoveItem = @{
|
||||
Path = ($BasePath + '\' + $GraphvizBasePath)
|
||||
Recurse = $true
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
|
||||
$MarkTextPath = ($BasePath + '\Mark Text.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $MarkTextPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $MarkTextPath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
#endregion Graphviz
|
||||
#endregion Tools
|
||||
|
||||
#region Browser
|
||||
$RegionName = 'Browser'
|
||||
$RegionNamePath = ($BasePath + '\' + $RegionName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $RegionNamePath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not ((Test-Path @paramTestPath)))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = ($BasePath)
|
||||
Name = $RegionName
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
#region Brave
|
||||
$BravePath = ($BasePath + '\Brave.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $BravePath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $BravePath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
#endregion Brave
|
||||
#endregion Browser
|
||||
|
||||
#region Office
|
||||
$RegionName = 'Office'
|
||||
$RegionNamePath = ($BasePath + '\' + $RegionName)
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $RegionNamePath
|
||||
PathType = 'Container'
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (-not ((Test-Path @paramTestPath)))
|
||||
{
|
||||
$paramNewItem = @{
|
||||
Path = ($BasePath)
|
||||
Name = $RegionName
|
||||
ItemType = 'Directory'
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (New-Item @paramNewItem)
|
||||
}
|
||||
|
||||
#region MicrosoftTeams
|
||||
$MicrosoftTeamsPath = ($BasePath + '\Microsoft Teams.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $MicrosoftTeamsPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $MicrosoftTeamsPath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
#endregion MicrosoftTeams
|
||||
|
||||
#region OneDrive
|
||||
$OneDrivePath = ($BasePath + '\OneDrive.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $OneDrivePath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramMoveItem = @{
|
||||
Path = $OneDrivePath
|
||||
Destination = $RegionNamePath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Move-Item @paramMoveItem)
|
||||
}
|
||||
#endregion OneDrive
|
||||
#endregion Office
|
||||
#endregion Structure
|
||||
|
||||
#region UninstallPIVManager
|
||||
$UninstallPIVManagerPath = ($BasePath + '\Yubico\Yubikey PIV Manager\Uninstall PIV Manager.lnk')
|
||||
|
||||
$paramTestPath = @{
|
||||
Path = $UninstallPIVManagerPath
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
if (Test-Path @paramTestPath)
|
||||
{
|
||||
$paramRemoveItem = @{
|
||||
Path = $UninstallPIVManagerPath
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
WarningAction = $SCT
|
||||
}
|
||||
$null = (Remove-Item @paramRemoveItem)
|
||||
}
|
||||
#endregion UninstallPIVManager
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
exit (0)
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,107 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Update all Microsoft Store Apps
|
||||
|
||||
.DESCRIPTION
|
||||
Update all Microsoft Store Apps
|
||||
|
||||
.NOTES
|
||||
There is a scheduled task that does this job, but we would like to enforce it!
|
||||
New version that use CIM instead of WMI
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Update all Microsoft Store Apps'
|
||||
|
||||
#region GlobalDefaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
# Wait a moment to make the command above work (Otherwise the delete might get blocked!!!)
|
||||
Start-Sleep -Seconds 2
|
||||
|
||||
$paramGetCimInstance = @{
|
||||
Namespace = 'Root\cimv2\mdm\dmmap'
|
||||
ClassName = 'MDM_EnterpriseModernAppManagement_AppManagement01'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
|
||||
$paramInvokeCimMethod = @{
|
||||
MethodName = 'UpdateScanMethod'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
#endregion GlobalDefaults
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
if ($pscmdlet.ShouldProcess('All Microsoft Store Apps', 'Update'))
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
$null = (Get-CimInstance @paramGetCimInstance | Invoke-CimMethod @paramInvokeCimMethod)
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
@@ -0,0 +1,126 @@
|
||||
#requires -Version 3.0 -RunAsAdministrator
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Update all help files for all installed PowerShell Modules
|
||||
|
||||
.DESCRIPTION
|
||||
Update all help files for all installed PowerShell Modules
|
||||
|
||||
.LINK
|
||||
http://enatec.io
|
||||
|
||||
.NOTES
|
||||
Version 1.0.2
|
||||
#>
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
begin
|
||||
{
|
||||
Write-Output -InputObject 'Update all help files for all installed PowerShell Modules'
|
||||
|
||||
#region GlobalDefaults
|
||||
$SCT = 'SilentlyContinue'
|
||||
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Disabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
|
||||
# Wait a moment to make the command above work (Otherwise the delete might get blocked!!!)
|
||||
Start-Sleep -Seconds 2
|
||||
#endregion GlobalDefaults
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
# Update the Module Information
|
||||
$paramGetModule = @{
|
||||
ListAvailable = $true
|
||||
Refresh = $true
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Module @paramGetModule)
|
||||
|
||||
# Stop Search - Gain performance
|
||||
$paramStopService = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$paramGetService = @{
|
||||
Name = 'WSearch'
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Get-Service @paramGetService | Where-Object {
|
||||
$_.Status -eq 'Running'
|
||||
} | Stop-Service @paramStopService)
|
||||
|
||||
# Update the Help
|
||||
$paramUpdateHelp = @{
|
||||
Force = $true
|
||||
Confirm = $false
|
||||
WarningAction = $SCT
|
||||
ErrorAction = $SCT
|
||||
}
|
||||
$null = (Update-Help @paramUpdateHelp)
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
if (Get-Command -Name 'Set-MpPreference' -ErrorAction $SCT)
|
||||
{
|
||||
$null = (Set-MpPreference -EnableControlledFolderAccess Enabled -Force -ErrorAction $SCT)
|
||||
}
|
||||
}
|
||||
|
||||
#region LICENSE
|
||||
<#
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, enabling Technology
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#>
|
||||
#endregion LICENSE
|
||||
|
||||
#region DISCLAIMER
|
||||
<#
|
||||
DISCLAIMER:
|
||||
- Use at your own risk, etc.
|
||||
- This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind
|
||||
- This is a third-party Software
|
||||
- The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way
|
||||
- The Software is not supported by Microsoft Corp (MSFT)
|
||||
- By using the Software, you agree to the License, Terms, and any Conditions declared and described above
|
||||
- If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution
|
||||
#>
|
||||
#endregion DISCLAIMER
|
||||
Reference in New Issue
Block a user