Merge branch 'master' of https://git.iut-rodez.fr/andre/Powershell_Scripts
This commit is contained in:
commit
4aa8f16d95
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.*~
|
@ -1,2 +1,3 @@
|
|||||||
# Powershell_Scripts
|
# Powershell_Scripts
|
||||||
|
|
||||||
|
Divers scripts en Powershell pour faciliter l'administration des PC Windows et des serveurs
|
40
Windows10/ADDReg1703.ps1
Normal file
40
Windows10/ADDReg1703.ps1
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
$WimFile = "D:\TEMP\Windows10_1703\sources\install.wim"
|
||||||
|
$MountPath = “D:\TEMP\Mount”
|
||||||
|
|
||||||
|
Mount-WindowsImage -ImagePath $WimFile -Index 1 -Path $MountPath
|
||||||
|
|
||||||
|
#region Customise Default User Profile
|
||||||
|
Write-Output -InputObject "`nCustomising the default user profile...`n"
|
||||||
|
REG LOAD "HKLM\_USER" "$MountPath\Users\Default\NTUSER.DAT" | Out-Null
|
||||||
|
REG LOAD "HKLM\_SOFTWARE" "$MountPath\Windows\System32\config\SOFTWARE" | Out-Null
|
||||||
|
|
||||||
|
# HKCU
|
||||||
|
& REG ADD "HKLM\_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v SystemPaneSuggestionsEnabled /d 0 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v PreInstalledAppsEnabled /d 0 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v OemPreInstalledAppsEnabled /d 0 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v DisableThumbnailCache /d 1 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v LaunchTo /d 1 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize" /v StartupDelayInMSec /d 0 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_USER\Software\Microsoft\Windows\CurrentVersion\Search" /v BingSearchEnabled /d 0 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_USER\Software\Microsoft\Windows\CurrentVersion\Search" /v SearchboxTaskbarMode /d 1 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_USER\Software\Policies\Microsoft\Internet Explorer\Restrictions" /v NoHelpItemSendFeedback /d 1 /t REG_DWORD /f
|
||||||
|
& REG DELETE "HKLM\_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /f
|
||||||
|
|
||||||
|
# HKLM
|
||||||
|
# & REG ADD "HKLM\_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v VerboseStatus /d 1 /t REG_DWORD /f
|
||||||
|
# & REG ADD "HKLM\_SOFTWARE\Policies\Microsoft\Internet Explorer\Main" /v DisableAddSiteMode /d 1 /t REG_DWORD /f
|
||||||
|
# & REG ADD "HKLM\_SOFTWARE\Policies\Microsoft\MRT" /v DontOfferThroughWUAU /d 1 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v DisableSoftLanding /d 1 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v DisableWindowsConsumerFeatures /d 1 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_SOFTWARE\Policies\Microsoft\WindowsStore" /v AutoDownload /d 2 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /v AutoDownload /d 2 /t REG_DWORD /f
|
||||||
|
# & REG ADD "HKLM\_SOFTWARE\Policies\Microsoft\Windows\Personalization" /v NoLockscreen /d 1 /t REG_DWORD /f
|
||||||
|
# & REG ADD "HKLM\_SOFTWARE\Policies\Microsoft\Windows\Windows Error Reporting" /v Disabled /d 1 /t REG_DWORD /f
|
||||||
|
# & REG ADD "HKLM\_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v AllowSearchToUseLocation /d 0 /t REG_DWORD /f
|
||||||
|
# & REG ADD "HKLM\_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v ConnectedSearchUseWeb /d 0 /t REG_DWORD /f
|
||||||
|
# & REG ADD "HKLM\_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v DisableWebSearch /d 1 /t REG_DWORD /f
|
||||||
|
& REG ADD "HKLM\_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoRebootWithLoggedOnUsers /d 1 /t REG_DWORD /f
|
||||||
|
|
||||||
|
REG UNLOAD "HKLM\_USER" | Out-Null
|
||||||
|
REG UNLOAD "HKLM\_SOFTWARE" | Out-Null
|
||||||
|
Dismount-WindowsImage -Path $MountPath -Save
|
8
Windows10/ApplyingNET35towim1703.ps1
Normal file
8
Windows10/ApplyingNET35towim1703.ps1
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
$UpdatesPath = "D:\TEMP\Update\*"
|
||||||
|
$MountPath = “D:\TEMP\Mount\”
|
||||||
|
$WimFile = “D:\TEMP\Windows10_1703\sources\install.wim”
|
||||||
|
DISM /Mount-Wim /WimFile:$WimFile /index:1 /Mountdir:$MountPath
|
||||||
|
DISM /image:$MountPath /enable-feature /featurename:NetFx3 /all /limitaccess /source:F:\sources\sxs
|
||||||
|
Write-Host "Updates Applied to WIM"
|
||||||
|
DISM /Unmount-Wim /Mountdir:$MountPath /commit
|
||||||
|
DISM /Cleanup-Wim
|
13
Windows10/ApplyingWindowsUpdatetowim1703.ps1
Normal file
13
Windows10/ApplyingWindowsUpdatetowim1703.ps1
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
$UpdatesPath = "D:\TEMP\Update\*"
|
||||||
|
$MountPath = “D:\TEMP\Mount\”
|
||||||
|
$WimFile = “D:\TEMP\Windows10_1703\sources\install.wim”
|
||||||
|
DISM /Mount-Wim /WimFile:$WimFile /index:1 /Mountdir:$MountPath
|
||||||
|
$UpdateArray = Get-Item $UpdatesPath
|
||||||
|
ForEach ($Updates in $UpdateArray)
|
||||||
|
{
|
||||||
|
DISM /image:$MountPath /Add-Package /Packagepath:$Updates
|
||||||
|
Start-Sleep –s 10
|
||||||
|
}
|
||||||
|
Write-Host "Updates Applied to WIM"
|
||||||
|
DISM /Unmount-Wim /Mountdir:$MountPath /commit
|
||||||
|
DISM /Cleanup-Wim
|
104
Windows10/removeapps.ps1
Normal file
104
Windows10/removeapps.ps1
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Removing Built-in apps from Windows 10 / Windows 8.1 / Windows 8
|
||||||
|
.DESCRIPTION
|
||||||
|
Removing Built-in apps from Windows 10 / Windows 8.1 / Windows 8
|
||||||
|
.PARAMETER
|
||||||
|
PathtoWim - Path to install.wim
|
||||||
|
select - Enable
|
||||||
|
.EXAMPLE
|
||||||
|
.\removeapps.ps1 -pathtowim c:\10\install.wim
|
||||||
|
.\removeapps.ps1 -pathtowim c:\10\install.wim -select $true
|
||||||
|
.\removeapps.ps1 -pathtowim c:\10\install.wim -select $true -index 2
|
||||||
|
.NOTES
|
||||||
|
Script name: removeapps.ps1
|
||||||
|
Version: 1.2
|
||||||
|
Author: André Picker
|
||||||
|
Contact: @clientmgmt
|
||||||
|
DateCreated: 2015-07-22
|
||||||
|
LastUpdate: 2016-03-08
|
||||||
|
#>
|
||||||
|
|
||||||
|
param (
|
||||||
|
[string]$pathtowim,
|
||||||
|
[bool]$selectapps,
|
||||||
|
[string]$index="1"
|
||||||
|
)
|
||||||
|
|
||||||
|
$Host.UI.RawUI.BackgroundColor = "Black"; Clear-Host
|
||||||
|
$startdate = (Get-Date).ToString()
|
||||||
|
$ProgressPreference=’SilentlyContinue’
|
||||||
|
|
||||||
|
function CreateTempDirectory {
|
||||||
|
$tmpDir = [System.IO.Path]::GetTempPath()
|
||||||
|
$tmpDir = [System.IO.Path]::Combine($tmpDir, [System.IO.Path]::GetRandomFileName())
|
||||||
|
[System.IO.Directory]::CreateDirectory($tmpDir) | Out-Null
|
||||||
|
$tmpDir
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pathworkfolder = CreateTempDirectory
|
||||||
|
Write-Host "Start:" $startdate -ForegroundColor White
|
||||||
|
Write-Host "Create temporary directory..." -ForegroundColor Green
|
||||||
|
Write-Host "Temporary directory:" $pathworkfolder -ForegroundColor Green
|
||||||
|
}
|
||||||
|
|
||||||
|
catch [Exception] {
|
||||||
|
Write-Host "Error:" $_.Exception.Message -ForegroundColor Red; break
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-Host "Mounting Windows-Image..." $pathtowim -ForegroundColor Green
|
||||||
|
Write-Host "Please wait..." -ForegroundColor White
|
||||||
|
Mount-WindowsImage -Path $pathworkfolder -ImagePath $pathtowim -Index $index | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
catch [Exception] {
|
||||||
|
Write-Host "Mounting Windows-Image failed..." -ForegroundColor Red;
|
||||||
|
Write-Host "Error:" $_.Exception.Message -ForegroundColor Red; break
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-Host "Remove the following Built-in apps:" -ForegroundColor Green
|
||||||
|
$apps = Get-AppxProvisionedPackage -Path $pathworkfolder | ForEach-Object {
|
||||||
|
|
||||||
|
if($selectapps -eq $true) {
|
||||||
|
$call = read-host "Do you really want to delete the following App:" $_.DisplayName "(Y/N)"
|
||||||
|
|
||||||
|
if($call -eq "y") {
|
||||||
|
Write-Host "Delete:" $_.DisplayName -ForegroundColor Green
|
||||||
|
Remove-AppxProvisionedPackage -Path $pathworkfolder -PackageName $_.PackageName
|
||||||
|
$call = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
Write-Host "Skipped:" $_.DisplayName -ForegroundColor yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
Write-Host "Delete:" $_.DisplayName -ForegroundColor Green
|
||||||
|
Remove-AppxProvisionedPackage -Path $pathworkfolder -PackageName $_.PackageName
|
||||||
|
$call = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
catch [Exception] {
|
||||||
|
Write-Host "Removing Built-in apps failed..." -ForegroundColor Red;
|
||||||
|
Write-Host "Error:" $_.Exception.Message -ForegroundColor Red; break
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-Host "Dismount-WindowsImage..." -ForegroundColor Green
|
||||||
|
Write-Host "Please wait..." -ForegroundColor White
|
||||||
|
Dismount-WindowsImage -Path $pathworkfolder -Save -CheckIntegrity | Out-Null
|
||||||
|
Write-Host "Remove temporary directory..." -ForegroundColor Green
|
||||||
|
Remove-Item $pathworkfolder -Recurse -Force | Out-Null
|
||||||
|
Write-Host "Complete:" (Get-Date).ToString() -ForegroundColor White
|
||||||
|
}
|
||||||
|
|
||||||
|
catch [Exception] {
|
||||||
|
Write-Host "Error:" $_.Exception.Message -ForegroundColor Red; break
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user