Ajout dela structure MDT dans Infra-LAB
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
[{000214A0-0000-0000-C000-000000000046}]
|
||||
Prop3=19,2
|
||||
[InternetShortcut]
|
||||
IDList=
|
||||
URL=http://127.0.0.1:8088/
|
||||
IconIndex=0
|
||||
HotKey=0
|
||||
IconFile=C:\wapt\wapt.ico
|
||||
@@ -0,0 +1,203 @@
|
||||
Function Import-SMSTSENV{
|
||||
try
|
||||
{
|
||||
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
|
||||
Write-Output "$ScriptName - tsenv is $tsenv "
|
||||
$MDTIntegration = "YES"
|
||||
|
||||
#$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
|
||||
Write-Output "$ScriptName - Running in standalonemode"
|
||||
$MDTIntegration = "NO"
|
||||
}
|
||||
Finally
|
||||
{
|
||||
if ($MDTIntegration -eq "YES"){
|
||||
$Logpath = $tsenv.Value("LogPath")
|
||||
$LogFile = $Logpath + "\" + "$ScriptName.log"
|
||||
|
||||
}
|
||||
Else{
|
||||
$Logpath = $env:TEMP
|
||||
$LogFile = $Logpath + "\" + "$ScriptName.log"
|
||||
}
|
||||
}
|
||||
}
|
||||
Function Start-Logging{
|
||||
start-transcript -path $LogFile -Force
|
||||
}
|
||||
Function Stop-Logging{
|
||||
Stop-Transcript
|
||||
}
|
||||
Function Invoke-Exe{
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
|
||||
param(
|
||||
[parameter(mandatory=$true,position=0)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Executable,
|
||||
|
||||
[parameter(mandatory=$false,position=1)]
|
||||
[string]
|
||||
$Arguments
|
||||
)
|
||||
|
||||
if($Arguments -eq "")
|
||||
{
|
||||
Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
|
||||
$ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
|
||||
}else{
|
||||
Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
|
||||
$ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
|
||||
}
|
||||
Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
|
||||
Return $ReturnFromEXE.ExitCode
|
||||
}
|
||||
|
||||
# Set vars
|
||||
$SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
|
||||
$SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
|
||||
$SOURCEROOT = "$SCRIPTDIR\Source"
|
||||
$SettingsFile = $SCRIPTDIR + "\" + $SettingsName
|
||||
$LANG = (Get-Culture).Name
|
||||
$OSV = $Null
|
||||
$ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
|
||||
|
||||
#Try to Import SMSTSEnv
|
||||
. Import-SMSTSENV
|
||||
|
||||
# Set more vars
|
||||
$Make = $tsenv.Value("Make")
|
||||
$Model = $tsenv.Value("Model")
|
||||
$ModelAlias = $tsenv.Value("ModelAlias")
|
||||
$MakeAlias = $tsenv.Value("MakeAlias")
|
||||
|
||||
#Start Transcript Logging
|
||||
. Start-Logging
|
||||
|
||||
#Output base info
|
||||
Write-Output ""
|
||||
Write-Output "$ScriptName - ScriptDir: $ScriptDir"
|
||||
Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
|
||||
Write-Output "$ScriptName - ScriptName: $ScriptName"
|
||||
Write-Output "$ScriptName - Current Culture: $LANG"
|
||||
Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
|
||||
Write-Output "$ScriptName - Log: $LogFile"
|
||||
Write-Output "$ScriptName - Model (win32_computersystem): $((Get-WmiObject Win32_ComputerSystem).model)"
|
||||
Write-Output "$ScriptName - Name (Win32_ComputerSystemProduct): $((Get-WmiObject Win32_ComputerSystemProduct).Name)"
|
||||
Write-Output "$ScriptName - Version (Win32_ComputerSystemProduct): $((Get-WmiObject Win32_ComputerSystemProduct).Version)"
|
||||
Write-Output "$ScriptName - Model (from TSENV): $Model"
|
||||
Write-Output "$ScriptName - ModelAlias (from TSENV): $ModelAlias"
|
||||
|
||||
#Check Model
|
||||
if($((Get-WmiObject Win32_ComputerSystem).model) -eq 'HP Compaq Pro 6305 SFF'){
|
||||
Write-Output "Model is $((Get-WmiObject Win32_ComputerSystem).model)"
|
||||
Write-Output "Checking BIOS Version"
|
||||
Write-Output "Version is $((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion)"
|
||||
if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne '68SVD Ver. F.50'){
|
||||
Write-Output "Needs upgrade"
|
||||
$Exe = 'hpqflash.exe'
|
||||
$Location = "$SCRIPTDIR\Source\HP EliteBook 8560w"
|
||||
$Executable = $Location + "\" + $exe
|
||||
Set-Location -Path $Location
|
||||
Invoke-Exe -Executable "$Executable" -Arguments "/s /p LCadmin1.bin" -Verbose
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Output "No Need to upgrade"
|
||||
}
|
||||
}
|
||||
if($((Get-WmiObject Win32_ComputerSystem).model) -eq 'HP ProBook 6570b'){
|
||||
Write-Output "Model is $((Get-WmiObject Win32_ComputerSystem).model)"
|
||||
Write-Output "Checking BIOS Version"
|
||||
Write-Output "Version is $((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion)"
|
||||
if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -Like '*ICE*'){
|
||||
if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne '68ICE Ver. F.62'){
|
||||
Write-Output "Needs upgrade"
|
||||
$Exe = 'hpqflash.exe'
|
||||
$Location = "$SCRIPTDIR\Source\HP ProBook 6570b"
|
||||
$Executable = $Location + "\" + $exe
|
||||
Set-Location -Path $Location
|
||||
Invoke-Exe -Executable "$Executable" -Arguments "/s /f 68ICE.cab" -Verbose
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Output "No Need to upgrade"
|
||||
}
|
||||
}
|
||||
if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -Like '*ICF*'){
|
||||
if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne '68ICF Ver. F.62'){
|
||||
Write-Output "Needs upgrade"
|
||||
$Exe = 'hpqflash.exe'
|
||||
$Location = "$SCRIPTDIR\Source\HP ProBook 6570b"
|
||||
$Executable = $Location + "\" + $exe
|
||||
Set-Location -Path $Location
|
||||
Invoke-Exe -Executable "$Executable" -Arguments "/s /f 68ICF.cab" -Verbose
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Output "No Need to upgrade"
|
||||
}
|
||||
}
|
||||
}
|
||||
if($ModelAlias -eq 'HP EliteBook 8460p'){
|
||||
Write-Output "Model is $((Get-WmiObject Win32_ComputerSystem).model)"
|
||||
Write-Output "Checking BIOS Version"
|
||||
Write-Output "Version is $((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion)"
|
||||
if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -Like '*SCF*'){
|
||||
if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne '68SCF Ver. F.63'){
|
||||
Write-Output "Needs upgrade"
|
||||
$Exe = 'hpqflash.exe'
|
||||
$Location = "$SCRIPTDIR\Source\HP EliteBook 8460p"
|
||||
$Executable = $Location + "\" + $exe
|
||||
Set-Location -Path $Location
|
||||
Invoke-Exe -Executable "$Executable" -Arguments "/s /f 68SCF.CAB" -Verbose
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Output "No Need to upgrade"
|
||||
}
|
||||
}
|
||||
if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -Like '*SCE*'){
|
||||
if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne '68SCE Ver. F.63'){
|
||||
Write-Output "Needs upgrade"
|
||||
$Exe = 'hpqflash.exe'
|
||||
$Location = "$SCRIPTDIR\Source\HP EliteBook 8460p"
|
||||
$Executable = $Location + "\" + $exe
|
||||
Set-Location -Path $Location
|
||||
Invoke-Exe -Executable "$Executable" -Arguments "/s /f 68SCE.CAB" -Verbose
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Output "No Need to upgrade"
|
||||
}
|
||||
}
|
||||
}
|
||||
if($((Get-WmiObject Win32_ComputerSystem).model) -eq 'HP Compaq dc7900 Small Form Factor'){
|
||||
Write-Output "Model is $((Get-WmiObject Win32_ComputerSystem).model)"
|
||||
Write-Output "Checking BIOS Version"
|
||||
Write-Output "Version is $((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion)"
|
||||
if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne '786G1 v01.27'){
|
||||
Write-Output "Needs upgrade"
|
||||
$Exe = 'hpqflash.exe'
|
||||
$Location = "$SCRIPTDIR\Source\HP Compaq dc7900 Small Form Factor\HPQFlash"
|
||||
$Executable = $Location + "\" + $exe
|
||||
$SourceFile = $Location + "\" + "Password01.bin"
|
||||
$Destination = $env:TEMP
|
||||
$DestinationFile = $Destination + "\" + "Password01.bin"
|
||||
Copy-Item -Path $SourceFile -Destination $DestinationFile -Force -Verbose
|
||||
Set-Location -Path $Location
|
||||
Invoke-Exe -Executable $Executable -Arguments "/s /p $DestinationFile"
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Output "No Need to upgrade"
|
||||
}
|
||||
}
|
||||
|
||||
#Stop Logging
|
||||
. Stop-Logging
|
||||
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
<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="Action">
|
||||
<start:Tile Size="2x2" Column="0" Row="2" AppUserModelID="Microsoft.MSPaint_8wekyb3d8bbwe!Microsoft.MSPaint" />
|
||||
</start:Group>
|
||||
<start:Group Name="Sensation">
|
||||
<start:Tile Size="4x2" Column="2" Row="0" AppUserModelID="Microsoft.Windows.Photos_8wekyb3d8bbwe!App" />
|
||||
</start:Group>
|
||||
</defaultlayout:StartLayout>
|
||||
</StartLayoutCollection>
|
||||
</DefaultLayoutOverride>
|
||||
</LayoutModificationTemplate>
|
||||
@@ -0,0 +1,9 @@
|
||||
@echo off
|
||||
rem Activation Bureau a distance
|
||||
|
||||
reg add "hklm\system\currentControlSet\Control\Terminal Server" /v "AllowTSConnections" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\system\currentControlSet\Control\Terminal Server" /v "fDenyTSConnections" /t REG_DWORD /d 0x0 /f >nul 2>&1
|
||||
sc config TermService start= auto >nul 2>&1
|
||||
net start Termservice >nul 2>&1
|
||||
netsh.exe advfirewall firewall add rule name="Bureau a distance (TCP)" dir=in action=allow description="Autorisation du RDP [TCP 3389]" enable=yes profile=private,domain,public localport=3389 protocol=tcp >nul 2>&1
|
||||
netsh.exe advfirewall firewall add rule name="Bureau a distance (UDP)" dir=in action=allow description="Autorisation du RDP [UDP 3389]" enable=yes profile=private,domain,public localport=3389 protocol=udp >nul 2>&1
|
||||
@@ -0,0 +1,14 @@
|
||||
@echo off
|
||||
echo Configuration Registre pour mise au Domaine
|
||||
|
||||
reg add "HKLM\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters" /v "DomainCompatibilityMode" /t REG_DWORD /d 1 /f
|
||||
reg add "HKLM\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters" /v "DNSNameResolutionRequired" /t REG_DWORD /d 0 /f
|
||||
|
||||
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v "CompatibleRUPSecurity" /t REG_DWORD /d 1 /f
|
||||
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v "SlowLinkDetectEnabled" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v "WaitForNetwork" /t REG_DWORD /d 0 /f
|
||||
|
||||
reg add "HKLM\SOFTWARE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "CompatibleRUPSecurity" /t REG_DWORD /d 1 /f
|
||||
|
||||
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "LsaAllowReturningUnencryptedSecrets" /t REG_DWORD /d 1 /f
|
||||
reg add "HKLM\SYSTEM\CurrentControlSet\Services\WebClient" /v "Start" /t REG_DWORD /d 4 /f
|
||||
@@ -0,0 +1,7 @@
|
||||
@echo off
|
||||
|
||||
reg export HKCR %SystemRoot%\TEMP\HKCR.Reg /y
|
||||
reg export HKCU %SystemRoot%\TEMP\HKCU.Reg /y
|
||||
reg export HKLM %SystemRoot%\TEMP\HKLM.Reg /y
|
||||
reg export HKU %SystemRoot%\TEMP\HKU.Reg /y
|
||||
reg export HKCC %SystemRoot%\TEMPHKCC.Reg /y
|
||||
@@ -0,0 +1 @@
|
||||
CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
|
||||
@@ -0,0 +1,9 @@
|
||||
@echo off
|
||||
|
||||
REM Clear Bios Password
|
||||
|
||||
cmd.exe /c %ScriptRoot%\BiosConfig\Dell\cctk.exe --setuppwd= --valsetuppwd=dellintel
|
||||
cmd.exe /c %ScriptRoot%\BiosConfig\Dell\cctk.exe --setuppwd= --valsetuppwd=crnpdc
|
||||
cmd.exe /c %ScriptRoot%\BiosConfig\Dell\cctk.exe --setuppwd= --valsetuppwd=CRHDF2020
|
||||
cmd.exe /c %ScriptRoot%\BiosConfig\Dell\cctk.exe --setuppwd= --valsetuppwd=crhdf
|
||||
cmd.exe /c %ScriptRoot%\BiosConfig\Dell\cctk.exe --setuppwd= --valsetuppwd=CRHDF
|
||||
@@ -0,0 +1,7 @@
|
||||
@echo Off
|
||||
cscript.exe c:\Windows\System32\slmgr.vbs /skms 10.0.14.20:1688
|
||||
timeout /t 2 /nobreak
|
||||
rem cscript.exe c:\Windows\System32\slmgr.vbs /ipk NW6C2-QMPVW-D7KKK-3GKT6-VCFB2
|
||||
rem timeout /t 2 /nobreak
|
||||
cscript.exe c:\Windows\System32\slmgr.vbs /ato
|
||||
timeout /t 2 /nobreak
|
||||
@@ -0,0 +1,12 @@
|
||||
@ECHO OFF
|
||||
|
||||
powercfg.exe /change disk-timeout-ac 0
|
||||
powercfg.exe /change disk-timeout-dc 0
|
||||
powercfg.exe /change standby-timeout-ac 0
|
||||
powercfg.exe /change standby-timeout-dc 0
|
||||
powercfg.exe /change hibernate-timeout-ac 0
|
||||
powercfg.exe /change hibernate-timeout-dc 0
|
||||
powercfg.exe /change monitor-timeout-ac 0
|
||||
|
||||
Copy-Item -Path "$DeployRoot\Scripts\ScriptRegion\outilsregion\Arrêter.lnk" -Destination "C:\Users\Public\Desktop"
|
||||
Copy-Item -Path "$DeployRoot\Scripts\ScriptRegion\outilsregion\Se Déconnecter.lnk" -Destination "C:\Users\Public\D
|
||||
@@ -0,0 +1,29 @@
|
||||
@echo off
|
||||
#Installation APPZ via Wapt
|
||||
|
||||
wapt-get update
|
||||
wapt-get upgrade
|
||||
wapt-get install util-7zip
|
||||
wapt-get install util-adobeair
|
||||
wapt-get install util-algobox
|
||||
wapt-get install util-audacity
|
||||
wapt-get install util-chrome
|
||||
wapt-get install util-firefox
|
||||
wapt-get install util-flashplayer
|
||||
wapt-get install util-formatfactory
|
||||
wapt-get install util-freemind
|
||||
wapt-get install util-geogebra
|
||||
wapt-get install util-geoplan-geospace
|
||||
wapt-get install util-java8
|
||||
wapt-get install util-libreoffice
|
||||
wapt-get install util-notepadplusplus
|
||||
wapt-get install util-photofiltre
|
||||
wapt-get install util-scratch
|
||||
wapt-get install util-sinequanon
|
||||
wapt-get install util-sketchup
|
||||
wapt-get install util-sumatrapdf
|
||||
wapt-get install util-vlc
|
||||
wapt-get install util-windowsmoviemaker
|
||||
wapt-get install util-xcas
|
||||
wapt-get install util-xmind
|
||||
wapt-get upgrade
|
||||
@@ -0,0 +1,17 @@
|
||||
@echo off
|
||||
#Installation APPZ via Wapt
|
||||
|
||||
wapt-get update
|
||||
wapt-get upgrade
|
||||
wapt-get install util-bimvision
|
||||
wapt-get install util-teklabimsight
|
||||
#wapt-get install adm-italc
|
||||
wapt-get install adm-robot_2018
|
||||
wapt-get install adm-autocad_2018
|
||||
wapt-get install adm-revit_2018
|
||||
wapt-get install adm-pluginferraillagerevit
|
||||
wapt-get install adm-precastextensionforrevit2018
|
||||
wapt-get install adm-structuralanalysistoolkitforautodeskrevit2018
|
||||
wapt-get install adm-revit_ini_2018
|
||||
wapt-get install adm-autocad_navisworks_2018
|
||||
wapt-get upgrade
|
||||
@@ -0,0 +1,56 @@
|
||||
@echo off
|
||||
echo Installation des outils en cours
|
||||
rem Activation Bureau a distance
|
||||
reg add "hklm\system\currentControlSet\Control\Terminal Server" /v "AllowTSConnections" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\system\currentControlSet\Control\Terminal Server" /v "fDenyTSConnections" /t REG_DWORD /d 0x0 /f >nul 2>&1
|
||||
sc config TermService start= auto >nul 2>&1
|
||||
net start Termservice >nul 2>&1
|
||||
netsh.exe advfirewall firewall add rule name="Bureau a distance (TCP)" dir=in action=allow description="Autorisation du RDP [TCP 3389]" enable=yes profile=private,domain,public localport=3389 protocol=tcp >nul 2>&1
|
||||
netsh.exe advfirewall firewall add rule name="Bureau a distance (UDP)" dir=in action=allow description="Autorisation du RDP [UDP 3389]" enable=yes profile=private,domain,public localport=3389 protocol=udp >nul 2>&1
|
||||
rem Installation de kwartz-auth
|
||||
@echo off
|
||||
rem Installation de kwartz-auth si pas present dans le netlogon
|
||||
if %kwartzauth%==false (
|
||||
copy /Y %Deployroot%\Scripts\ScriptRegion\outilsregion\kwartz-auth.exe c:\windows\system32
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "kwartz-auth" /t REG_SZ /d "kwartz-auth.exe" /f
|
||||
netsh advfirewall firewall add rule name="kwartz-auth.exe" dir=in action=allow program="c:\windows\system32\kwartz-auth.exe" enable=yes
|
||||
)
|
||||
rem Configuration WSUS
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate" /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate" /v "ElevateNonAdmins" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate" /v "DisableWindowsUpdateAccess" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate" /v "AcceptTrustedPublisherCerts" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate" /v "TargetGroup" /t REG_SZ /d LYC-%id% /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate" /v "TargetGroupEnabled" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate" /v "WUServer" /t REG_SZ /d "http://l%rne%-dss:8530" /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate" /v "WUStatusServer" /t REG_SZ /d "http://l%rne%-dss:8530" /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "UseWUServer" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 0x0 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "DetectionFrequencyEnabled" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "DetectionFrequency" /t REG_DWORD /d 0x2 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "RebootRelaunchTimeoutEnabled" /t REG_DWORD /d 0x0 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "RebootRelaunchTimeout" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "AutoInstallMinorUpdates" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "NoAutoRebootWithLoggedOnUsers" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "AUOptions" /t REG_DWORD /d 0x4 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "ScheduledInstallDay" /t REG_DWORD /d 0x0 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "ScheduledInstallTime" /t REG_DWORD /d 0xc /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "RebootWarningTimeoutEnabled" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "RebootWarningTimeout" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "RescheduleWaitTimeEnabled" /t REG_DWORD /d 0x0 /f >nul 2>&1
|
||||
reg add "hklm\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" /v "RescheduleWaitTime" /t REG_DWORD /d 0x1 /f >nul 2>&1
|
||||
sc config wuauserv start= auto >nul
|
||||
net start wuauserv >nul
|
||||
rem Installation Wapt
|
||||
start "" /wait %Deployroot%\Scripts\ScriptRegion\outilsregion\waptagent.exe /VERYSILENT
|
||||
copy /Y %Deployroot%\Scripts\ScriptRegion\outilsregion\wapt-get.ini c:\wapt > nul
|
||||
ping 127.0.0.1 -n 10 > nul
|
||||
c:\wapt\wapt-get.exe setup-tasks
|
||||
copy /Y "%Deployroot%\Scripts\ScriptRegion\outilsregion\Bibliotheque de logiciels.url" c:\users\public\desktop > nul
|
||||
CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe" > nul
|
||||
rem Installation Fusion inventory
|
||||
start /wait %Deployroot%\Scripts\ScriptRegion\outilsregion\fusion\fusioninventory-agent_windows-x64_2.4.1 /acceptlicense /debug=0 /execmode=Service /httpd /httpd-trust='127.0.0.1/32' /installtype=from-scratch /runnow /tag=%rne% /task-frequency=Daily /add-firewall-exception /proxy='http://%kwartz%:3128' /S /server='https://%kwartz%:443/glpi/plugins/fusioninventory' /no-ssl-check
|
||||
rem Clé publique Nomachine
|
||||
copy /Y %Deployroot%\Scripts\ScriptRegion\outilsregion\authorized.crt c:\users\administrateur\.nx\config
|
||||
exit
|
||||
@@ -0,0 +1,118 @@
|
||||
Import-Module $PSScriptRoot\Set-LenovoBIOSSettings.ps1
|
||||
|
||||
# Configuration BIOS Lenovo pour ThinkCentre neo 50s Gen 3/4/5.
|
||||
# Les paramètres sont organisés en hashtable pour une lisibilité et maintenance faciles.
|
||||
# Chaque clé est le nom du paramètre, la valeur est le réglage souhaité.
|
||||
|
||||
$BIOSSettings = @{
|
||||
|
||||
# Paramètres USB
|
||||
"USBPortAccess" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"USBEnumerationDelay" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
"FrontUSBPorts" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"RearUSBPorts" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"USBPort1" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"USBPort2" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"USBPort3" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"USBPort5" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"USBPort6" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"USBPort7" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"USBPort8" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
|
||||
# Paramètres SATA
|
||||
"SATAController" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"SATADrive1" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"SATADrive2" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"SATADrive1HotPlugSupport" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
"SATADrive2HotPlugSupport" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
"ConfigureSATAas" = "AHCI" # [Optional:AHCI,Intel(R) RST with Intel(R) Optane]
|
||||
|
||||
# Paramètres disque dur et vidéo
|
||||
"HardDiskPre-delay" = "Disabled" # [Optional:Disabled,3 Seconds,6 Seconds,9 Seconds,12 Seconds,15 Seconds,21 Seconds,...]
|
||||
"SelectActiveVideo" = "Auto" # [Optional:IGD,PEG,Auto]
|
||||
|
||||
# Paramètres audio et réseau
|
||||
"OnboardAudioController" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"InternalSpeaker" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"OnboardEthernetController" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"PXEIPV4NetworkStack" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"PXEIPV6NetworkStack" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
|
||||
# Paramètres PCIe et ASPM
|
||||
"ASPMSupport" = "Auto" # [Optional:Auto,Disabled]
|
||||
"PCIe16xSlotSpeed" = "Auto" # [Optional:Auto,Gen1,Gen2,Gen3,Gen4]
|
||||
"PCIe1xSlotSpeed" = "Auto" # [Optional:Auto,Gen1,Gen2,Gen3]
|
||||
|
||||
# Paramètres processeur et virtualisation
|
||||
"SpeedShiftTechnology" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"HyperThreadingTechnology" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"CoreMultiProcessing" = "Enabled" # [Optional:Enabled,Disabled]
|
||||
"VirtualizationTechnology" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"VTdFeature" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"C1ESupport" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"CStateSupport" = "C1C3C6C7C8C10" # [Optional:C1,C1C3,C1C3C6,C1C3C6C7,C1C3C6C7C8,C1C3C6C7C8C10]
|
||||
"TurboMode" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"IntelSIPPSupport" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
|
||||
# Paramètres énergie et refroidissement
|
||||
"DustShieldAlert" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
"IntelDPTFSupport" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"AfterPowerLoss" = "Last State" # [Optional:Power Off,Power On,Last State]
|
||||
"EnhancedPowerSavingMode" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
"SmartPowerOn" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"IntelligentCoolingPerformanceMode" = "Performance mode" # [Optional:Performance mode,Balance mode,Full Speed]
|
||||
|
||||
# Paramètres Wake-on-LAN et alarme
|
||||
"WakeonLAN" = "Enabled" # [Optional:Enabled,Disabled]
|
||||
"WakeUponAlarm" = "Disabled" # [Optional:Single Event,Daily Event,Weekly Event,Disabled,User Defined]
|
||||
"AlarmTime" = "[00:00:00]" # [Status:ShowOnly]
|
||||
"AlarmDate" = "[01/01/2021]" # [Status:ShowOnly]
|
||||
"AlarmDayofWeek" = "Sunday" # [Optional:Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday][Status:ShowOnly]
|
||||
"UserDefinedAlarmSunday" = "Disabled" # [Optional:Disabled,Enabled][Status:ShowOnly]
|
||||
"UserDefinedAlarmMonday" = "Disabled" # [Optional:Disabled,Enabled][Status:ShowOnly]
|
||||
"UserDefinedAlarmTuesday" = "Disabled" # [Optional:Disabled,Enabled][Status:ShowOnly]
|
||||
"UserDefinedAlarmWednesday" = "Disabled" # [Optional:Disabled,Enabled][Status:ShowOnly]
|
||||
"UserDefinedAlarmThursday" = "Disabled" # [Optional:Disabled,Enabled][Status:ShowOnly]
|
||||
"UserDefinedAlarmFriday" = "Disabled" # [Optional:Disabled,Enabled][Status:ShowOnly]
|
||||
"UserDefinedAlarmSaturday" = "Disabled" # [Optional:Disabled,Enabled][Status:ShowOnly]
|
||||
"UserDefinedAlarmTime" = "[00:00:00]" # [Status:ShowOnly]
|
||||
|
||||
# Paramètres sécurité
|
||||
"AccessSecuritySettings" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
"RemoteSetSMP" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
"RequireHDPonSystemBoot" = "Auto" # [Optional:No,Auto,Power On]
|
||||
"BlockSIDAuthentication" = "Enabled" # [Optional:Enabled,Disabled]
|
||||
"SetMinimumLength" = "Disabled" # [Optional:Disabled,4 Characters,5 Characters,6 Characters,7 Characters,8 Characters...]
|
||||
"SetStrongPassword" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
"KeyBoardLayout" = "English" # [Optional:English,French,German,Russian,Chinese]
|
||||
"BIOSPasswordAtSystemBoot" = "Yes" # [Optional:No,Yes]
|
||||
"BIOSPasswordAtReboot" = "No" # [Optional:No,Yes]
|
||||
"BIOSPasswordAtBootDeviceList" = "No" # [Optional:No,Yes][Status:ShowOnly]
|
||||
"RequireSVPwhenFlashing" = "No" # [Optional:No,Yes]
|
||||
"AllowJumperClearSVP" = "Yes" # [Optional:No,Yes][Status:ShowOnly]
|
||||
"PasswordCountExceededError" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"SecureRollBackPrevention" = "Yes" # [Optional:No,Yes]
|
||||
"WindowsUEFIFirmwareUpdate" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"SmartUSBProtection" = "Disabled" # [Optional:Disabled,Read Only,No Access]
|
||||
"securewipe" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
"SecurityChip" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"PhysicalPresenceforClear" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"SecureBoot" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"AbsolutePersistenceModule" = "Enabled" # [Optional:Disabled,Enabled,Permanently Disabled]
|
||||
"DeviceGuard" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
"CoverTamperDetected" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
"ConfigurationChangeDetection" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
|
||||
# Paramètres démarrage
|
||||
"Firstbootdevice" = "Boot Order" # [Optional:Boot Order,Network,SATA Drive,M.2 Drive,PCIe Drive,VMD Drive,USB HDD,USB...]
|
||||
"BootUpNumLockStatus" = "On" # [Optional:Off,On]
|
||||
"FastBoot" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"OptionKeysDisplay" = "Disabled" # [Optional:Disabled,Enabled]
|
||||
"UsbBootSupport" = "Enabled" # [Optional:Disabled,Enabled]
|
||||
"BootOrder" = "PCIE SLOT 1:Network 1:USB HDD 1" # [Excluded from boot order:]
|
||||
}
|
||||
|
||||
# Conversion en tableau de chaînes pour Set-LenovoBIOSSettings
|
||||
$Settings = $BIOSSettings.GetEnumerator() | ForEach-Object { "$($_.Key),$($_.Value)" }
|
||||
|
||||
Set-LenovoBIOSSettings -ComputerName $env:computername -SettingsToBeApplied $Settings
|
||||
@@ -0,0 +1,15 @@
|
||||
Import-Module $PSScriptRoot\Set-LenovoBIOSSettings.ps1
|
||||
|
||||
# Liste lisible des paramètres BIOS Lenovo pour ThinkCentre neo 50s Gen 3/4/5.
|
||||
# Les noms des paramètres sont ceux attendus par Set-LenovoBIOSSettings.
|
||||
# IMPORTANT: ne pas insérer d'espace après la virgule séparant le nom et la valeur.
|
||||
$Settings = @(
|
||||
"AfterPowerLoss,Last State;[Optional:Power Off,Power On,Last State]",
|
||||
"BootPriority,UEFI;[Optional:UEFI,Legacy]",
|
||||
"BootUpNum-LockStatus,On;[Optional:Off,On]",
|
||||
"PXEIPV6networkstack,Disabled;[Optional:Disabled,Enabled]",
|
||||
"SecureBoot,Enabled;[Optional:Disabled,Enabled]",
|
||||
"WakeonLAN,Automatic;[Optional:Primary,Automatic,Disabled]"
|
||||
)
|
||||
|
||||
Set-LenovoBIOSSettings -ComputerName $env:computername -SettingsToBeApplied $Settings
|
||||
@@ -0,0 +1,86 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Configuration WSUS avec la fonction infosEtab
|
||||
|
||||
.DESCRIPTION
|
||||
La fonction Get-InfosEtab récupère l'adresse IP du serveur WSUS en utilisant la résolution de nom DNS.
|
||||
Le paramètre <-verbose> indique des informations supplémentaires.
|
||||
|
||||
.PARAMETER
|
||||
<Dssdns> chaine de caractère définissant le nom du serveur WSUS.
|
||||
|
||||
.EXAMPLE
|
||||
$InfosEtab.NumLyc
|
||||
|
||||
.NOTES
|
||||
Auteurs :
|
||||
Patrick Pattyn et Aurélien Hamez - UTIL Secteur 2
|
||||
Région Hauts de France
|
||||
#>
|
||||
|
||||
$InfoEtab = Get-InfosEtab
|
||||
[int]$NumRxLyc = $InfoEtab.NumRxLyc
|
||||
|
||||
# On teste si le NumLyc à besoin d'un 0 ou de deux
|
||||
if( $NumRxLyc -ge '100')
|
||||
{
|
||||
Write-Host "Le script continue"
|
||||
$TargetGroup = 'LYC-' + $NumRxLyc
|
||||
}
|
||||
elseif( $NumRxLyc -ge '10' -and $NumRxLyc -le '99')
|
||||
{
|
||||
$TargetGroup = 'LYC-0' + $NumRxLyc
|
||||
}
|
||||
else
|
||||
{
|
||||
$TargetGroup = 'LYC-00' + $NumRxLyc
|
||||
}
|
||||
|
||||
$AdressServeurWSUS = "http://" + $InfoEtab.DSSIP + ":8530"
|
||||
|
||||
Write-Host Configuration de Windows Update en cours.
|
||||
|
||||
$Key = "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate"
|
||||
|
||||
if( -Not ( Test-Path "Registry::$Key"))
|
||||
{
|
||||
New-Item -Path $Key -ItemType RegistryKey -Force
|
||||
}
|
||||
|
||||
New-ItemProperty $Key -Name “TargetGroup” -Type "String" -Value $TargetGroup -Force
|
||||
New-ItemProperty $Key -Name “TargetGroupEnabled” -Type DWORD -Value 1 -Force
|
||||
|
||||
New-ItemProperty $Key -Name “WUServer” -Type "String" -Value $AdressServeurWSUS -Force
|
||||
New-ItemProperty $Key -Name “WUStatusServer” -Type "String" -Value $AdressServeurWSUS -Force
|
||||
|
||||
New-ItemProperty $Key -Name “ElevateNonAdmins” -Type DWORD -Value 1 -Force
|
||||
New-ItemProperty $Key -Name “AcceptTrustedPublisherCerts” -Type DWORD -Value 1 -Force
|
||||
New-ItemProperty $Key -Name “DisableWindowsUpdateAccess” -Type DWORD -Value 1 -Force
|
||||
|
||||
$KeyAU = "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU"
|
||||
|
||||
if( -Not ( Test-Path "Registry::$Key"))
|
||||
{
|
||||
New-Item -Path $KeyAU -ItemType RegistryKey -Force
|
||||
}
|
||||
|
||||
New-ItemProperty $KeyAU -Name “NoAutoRebootWithLoggedOnUsers” -Type DWORD -Value 1 -Force
|
||||
New-ItemProperty $KeyAU -Name “RebootRelaunchTimeoutEnabled” -Type DWORD -Value 0 -Force
|
||||
New-ItemProperty $KeyAU -Name “RebootWarningTimeoutEnabled” -Type DWORD -Value 1 -Force
|
||||
New-ItemProperty $KeyAU -Name “RescheduleWaitTimeEnabled” -Type DWORD -Value 0 -Force
|
||||
New-ItemProperty $KeyAU -Name “AutoInstallMinorUpdates” -Type DWORD -Value 1 -Force
|
||||
New-ItemProperty $KeyAU -Name “DetectionFrequencyEnabled” -Type DWORD -Value 1 -Force
|
||||
New-ItemProperty $KeyAU -Name “DetectionFrequency” -Type DWORD -Value 2 -Force
|
||||
New-ItemProperty $KeyAU -Name “UseWUServer” -Type DWORD -Value 1 -Force
|
||||
New-ItemProperty $KeyAU -Name “AUPowerManagement” -Type DWORD -Value 1 -Force
|
||||
New-ItemProperty $KeyAU -Name “NoAUAsDefaultShutdownOption” -Type DWORD -Value 1 -Force
|
||||
New-ItemProperty $KeyAU -Name “NoAUShutdownOption” -Type DWORD -Value 0 -Force
|
||||
New-ItemProperty $KeyAU -Name “RebootRelaunchTimeout” -Type DWORD -Value 1 -Force
|
||||
New-ItemProperty $KeyAU -Name “ScheduledInstallDay” -Type DWORD -Value 0 -Force
|
||||
New-ItemProperty $KeyAU -Name “ScheduledInstallTime” -Type DWORD -Value 12 -Force
|
||||
New-ItemProperty $KeyAU -Name “RebootWarningTimeout” -Type DWORD -Value 1 -Force
|
||||
New-ItemProperty $KeyAU -Name “RescheduleWaitTime” -Type DWORD -Value 1 -Force
|
||||
New-ItemProperty $KeyAU -Name “AUOptions” -Type DWORD -Value 4 -Force
|
||||
|
||||
# Forcer le client à contacter le serveur WSUS
|
||||
Wuauclt /detectnow
|
||||
@@ -0,0 +1,7 @@
|
||||
# Ce Script efface le dossier Windows.old apères un upgrade
|
||||
|
||||
takeown /F C:\Windows.old* /R /A /D Y
|
||||
|
||||
cacls c:\Windows.old\*.* /T /grant administrators:F
|
||||
|
||||
rmdir /S /Q c:\Windows.old
|
||||
@@ -0,0 +1,3 @@
|
||||
$nic = (Get-NetAdapter -physical) | select -expand name
|
||||
Disable-NetAdapterBinding -InterfaceAlias $nic -ComponentID ms_tcpip6
|
||||
Disable-NetAdapterBinding -InterfaceAlias $nic -ComponentID ms_lldp
|
||||
@@ -0,0 +1,2 @@
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\SecurityHealthService" -Name "Start" -Value 3
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "SecurityHealth"
|
||||
@@ -0,0 +1,107 @@
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Enable Wake On LAN settings on NIC in Windows
|
||||
|
||||
.DESCRIPTION
|
||||
|
||||
IMPORTANT NOTE: I borrowed some from the WMI portions from here: http://justanothertechnicalblog.blogspot.com/2012/06/setting-power-management-options-on.html
|
||||
|
||||
This script will set the appropriate Windows-side
|
||||
Wake-On LAN settings on the NIC that is currently
|
||||
CONNECTED and has a match for the name "Ethernet"
|
||||
OR "Local Area Connection"
|
||||
|
||||
This script will check/set the following:
|
||||
|
||||
1. "Allow the device to wake the computer" to CHECKED
|
||||
2. "Only allow a magic packet to wake the computer" to CHECKED
|
||||
3. "Energy Efficient Ethernet" to OFF
|
||||
4. Fast Startup to DISABLED (Windows 8-10 only)
|
||||
|
||||
===============================================================
|
||||
If your NIC is named something else, just change the "-match"
|
||||
references on the "Get-NetAdapter" command below
|
||||
===============================================================
|
||||
|
||||
NOTE: You will still need to make certain Wake On LAN is enabled
|
||||
in the BIOS.
|
||||
|
||||
written by Mike Resnick 05-15-2018
|
||||
|
||||
#>
|
||||
|
||||
$nic = Get-NetAdapter | ? {($_.MediaConnectionState -eq "Connected") -and (($_.name -match "Ethernet") -or ($_.name -match "local area connection"))}
|
||||
$nicPowerWake = Get-WmiObject MSPower_DeviceWakeEnable -Namespace root\wmi | where {$_.instancename -match [regex]::escape($nic.PNPDeviceID) }
|
||||
If ($nicPowerWake.Enable -eq $true)
|
||||
{
|
||||
# All good here
|
||||
write-output "MSPower_DeviceWakeEnable is TRUE"
|
||||
}
|
||||
Else
|
||||
{
|
||||
write-output "MSPower_DeviceWakeEnable is FALSE. Setting to TRUE..."
|
||||
$nicPowerWake.Enable = $True
|
||||
$nicPowerWake.psbase.Put()
|
||||
}
|
||||
|
||||
$nicMagicPacket = Get-WmiObject MSNdis_DeviceWakeOnMagicPacketOnly -Namespace root\wmi | where {$_.instancename -match [regex]::escape($nic.PNPDeviceID) }
|
||||
If ($nicMagicPacket.EnableWakeOnMagicPacketOnly -eq $true)
|
||||
{
|
||||
# All good here
|
||||
write-output "EnableWakeOnMagicPacketOnly is TRUE"
|
||||
}
|
||||
Else
|
||||
{
|
||||
write-output "EnableWakeOnMagicPacketOnly is FALSE. Setting to TRUE..."
|
||||
$nicMagicPacket.EnableWakeOnMagicPacketOnly = $True
|
||||
$nicMagicPacket.psbase.Put()
|
||||
}
|
||||
|
||||
# Since different NICs will have different registry keys,
|
||||
# this recursively scans through the reigstry to find the
|
||||
# the EEELinkAdvertisement property
|
||||
$FindEEELinkAd = Get-ChildItem "hklm:\SYSTEM\ControlSet001\Control\Class" -Recurse -ErrorAction SilentlyContinue | % {Get-ItemProperty $_.pspath} -ErrorAction SilentlyContinue | ? {$_.EEELinkAdvertisement} -ErrorAction SilentlyContinue
|
||||
If ($FindEEELinkAd.EEELinkAdvertisement -eq 1)
|
||||
{
|
||||
Set-ItemProperty -Path $FindEEELinkAd.PSPath -Name EEELinkAdvertisement -Value 0
|
||||
# Check again
|
||||
$FindEEELinkAd = Get-ChildItem "hklm:\SYSTEM\ControlSet001\Control\Class" -Recurse -ErrorAction SilentlyContinue | % {Get-ItemProperty $_.pspath} | ? {$_.EEELinkAdvertisement}
|
||||
If ($FindEEELinkAd.EEELinkAdvertisement -eq 1)
|
||||
{
|
||||
write-output "$($env:computername) - ERROR - EEELinkAdvertisement set to $($FindEEELinkAd.EEELinkAdvertisement)"
|
||||
}
|
||||
Else
|
||||
{
|
||||
write-output "$($env:computername) - SUCCESS - EEELinkAdvertisement set to $($FindEEELinkAd.EEELinkAdvertisement)"
|
||||
}
|
||||
}
|
||||
Else
|
||||
{
|
||||
write-output "EEELinkAdvertisement is already turned OFF"
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Disable Fast Startup in Windows 8-10 (Fast Startup breaks Wake On LAN)
|
||||
If ((gwmi win32_operatingsystem).caption -match "Windows 8")
|
||||
{
|
||||
write-output "Windows 8.x detected. Disabling Fast Startup, as this breaks Wake On LAN..."
|
||||
powercfg -h off
|
||||
}
|
||||
ElseIf ((gwmi win32_operatingsystem).caption -match "Windows 10")
|
||||
{
|
||||
write-output "Windows 10 detected. Disabling Fast Startup, as this breaks Wake On LAN..."
|
||||
# This checks if HiberbootEnabled is equal to 1
|
||||
$FindHiberbootEnabled = Get-ItemProperty "hklm:\SYSTEM\CurrentControlSet\Control\Session?Manager\Power" -ErrorAction SilentlyContinue
|
||||
If ($FindHiberbootEnabled.HiberbootEnabled -eq 1)
|
||||
{
|
||||
write-output "HiberbootEnabled is Enabled. Setting to DISABLED..."
|
||||
Set-ItemProperty -Path $FindHiberbootEnabled.PSPath -Name "HiberbootEnabled" -Value 0 -Type DWORD -Force | Out-Null
|
||||
}
|
||||
Else
|
||||
{
|
||||
write-output "HiberbootEnabled is already DISABLED"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
Function Get-LenovoBIOSSettings {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Get-LenovoBIOSSettings is a function which acquires all of the bios settings currently configured for any particular lenovo-based computer that is running PowerShell version 4 or greater.
|
||||
.DESCRIPTION
|
||||
This Function is inspired by the fact that Lenovo has very poor documentation on how to properly apply bios settings via script.
|
||||
The information used for this function can be found here: http://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles_pdf/sb_deploy.pdf
|
||||
To use this function effectively, follow these steps:
|
||||
1. First, find a test Lenovo pc.
|
||||
2. Set the Lenovo Bios back to factory defaults, and then change those bios settings that you would like to deploy.
|
||||
3. Boot the test pc to windows and run Get-LenovoBIOSSettings.
|
||||
4. Now should you have a Log file that has a list of all settings, copy the lines of settings you would like to apply. Each line should be it's own string.
|
||||
5. In your deployment script, create a list containing those strings of settings and feed that list to Set-BIOSSettings.
|
||||
Log file(s) available here:
|
||||
• \\targetpc\c$\windows\logs\GetLenovoBiosSettings_(DATE).log
|
||||
• c:\windows\logs\GetLenovoBiosSettings_(DATE).log
|
||||
• and\or the host\console window (depending on how you choose to run this function)
|
||||
By getting the settings from wmi and outputting them to a log file, you can get the proper string to feed into Set-LenovoBIOSSettings for almost any setting regardless of what Lenovo’s documentation says.
|
||||
The output from Get-LenovoBIOSSettings is not automatically compatible with the $SettingsToBeApplied parameter in the Set-LenovoBIOSSettings function.
|
||||
Instead, this is designed to merely give you all possible settings (in their correct format) that may be configured for any particular model of Lenovo.
|
||||
Once you have the list, pick and choose which settings that you would like to feed to Set-LenovoBiosSettings.
|
||||
Use: Help Get-LenovoBiosSettings –FULL and Help set-LenovoBiosSettings –FULL to see examples of its usage.
|
||||
.PARAMETER computername
|
||||
$Get-LenovoBIOSSettings by default will attempt to acquire the currently applied BIOS settings on the computer that the script is running on. This behavior can be changed by specifying the $ComputerName parameter.
|
||||
.EXAMPLE
|
||||
Here is an example on how to acquire a list of properly configured settings from the test Lenovo PC:
|
||||
Get-LenovoBIOSSettings -ComputerName Some-PC
|
||||
After Power Loss,Last State;[Optional:Power Off,Power On,Last State]
|
||||
Alarm Date(MM/DD/YYYY),[01/01/1999][Status:ShowOnly]
|
||||
Alarm Day of Week,Sunday;[Optional:Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday][Status:ShowOnly]
|
||||
Alarm Time(HH:MM:SS),[00:00:00][Status:ShowOnly]
|
||||
Allow Flashing BIOS to a Previous Version,Yes;[Optional:No,Yes]
|
||||
Automatic Boot Sequence,Network 1:SATA 1:SATA 2:SATA 3:USB CDROM:USB KEY:USB HDD:eSATA:Other Device:USB FDD
|
||||
Boot Agent,PXE;[Optional:Disabled,PXE]
|
||||
...etc, usually there are many settings, and you typically would not want to select them all, just manually select those settings that you would like to configure, that aren't already configured by default.
|
||||
Then, manually create a list of settings to be used with Set-LenovoBIOSSettings.
|
||||
$Settings = "Allow Flashing BIOS to a Previous Version,Yes;[Optional:No,Yes]","Boot Agent,PXE;[Optional:Disabled,PXE]","Boot Mode,Auto;[Optional:Auto,UEFI,Legacy]"
|
||||
Notice that this is a list of strings "","","" In-between each pair of quotes, paste 1 setting. Create any length list desired.
|
||||
Now feed the list to Set-LenovoBIOSSettings
|
||||
Set-LenovoBIOSSettings -ComputerName Some-PC -SettingsToBeApplied $Settings
|
||||
.EXAMPLE
|
||||
It is also possible to select particular settings from the output and pipe it to Set-LenovoBIOSSettings. But this is not recommended, unless you already know which strings to select to begin with:
|
||||
Get-LenovoBIOSSettings -ComputerName Some-PC | Select-String "Wake on Lan" | Set-LenovoBIOSSettings -ComputerName Some-PC
|
||||
.LINK
|
||||
http://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles_pdf/sb_deploy.pdf
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$FALSE, ValueFromPipeline=$true,Position=0)]
|
||||
[string]$ComputerName = (Get-Content env:computername))
|
||||
|
||||
#Defining Write-Log and Create-LogFile within the Function, to make logging easier.
|
||||
|
||||
Function Create-LogFile{
|
||||
[CmdletBinding()]
|
||||
|
||||
param([Parameter(Mandatory=$true, ValueFromPipeline=$true,Position=0)]
|
||||
[string]$LogName,
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=1)]
|
||||
[string]$LogfileVarName = 'LogFile',
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=2)]
|
||||
[string]$LogFileScope = 'Global')
|
||||
|
||||
$LogFileString = "c:\windows\logs\$($LogName)_$(get-date -UFormat %m-%d-%y).log"
|
||||
|
||||
if (Test-Path $LogFileString){Remove-Item -Path $LogFileString -Force}
|
||||
|
||||
Set-Variable -Name $LogfileVarName -Value $LogFileString -Scope $LogFileScope -Force}
|
||||
|
||||
Function Write-Log {
|
||||
[CmdletBinding()]
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=0)]
|
||||
[string]$message,
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=1)]
|
||||
[string]$LogName = "REPLACE",
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=2)]
|
||||
[string]$LogfileVarName = 'LogFile',
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=3)]
|
||||
[string]$LogFileScope = 'Global')
|
||||
|
||||
#The Messaging Script Block, to be executed only if $LogFile exists.
|
||||
|
||||
$MessageScriptBlock = {
|
||||
# Call Write-Log followed by a qouted message to log it in the log file and display it on the screen.
|
||||
#Some output will not display on the host screen, but will display on the log file.
|
||||
|
||||
if ($message -eq $null){
|
||||
Write-Host " "
|
||||
" "| Out-File -FilePath $LogFile -Force -Append; Return}
|
||||
|
||||
if ($message -ne $null) {
|
||||
$message = "--"+ $message + " - $(Get-Date -Format "hh:mm:ss tt")--"
|
||||
Write-Host $message
|
||||
$message | Out-File -FilePath $LogFile -Force -Append}}
|
||||
|
||||
if ((Get-Variable $LogfileVarName) -eq $null) {
|
||||
|
||||
if ((Get-Command -Name Create-LogFile) -ne $null) {Create-LogFile -LogName $LogName}
|
||||
|
||||
else {
|
||||
|
||||
Write-Host "There is no log file nor is there a `"Create-LogFile`" Function available"
|
||||
Write-Host "Creating a Logfile to continue the script: c:\windows\logs\REPLACE.log"
|
||||
$LogFileString = "c:\windows\logs\REPLACE.log"
|
||||
|
||||
if (Test-Path $LogFileString){Remove-Item -Path $LogFileString -Force}
|
||||
Set-Variable -Name $LogfileVarName -Value $LogFileString -Scope $LogFileScope -Force}}
|
||||
|
||||
Invoke-Command -ScriptBlock $MessageScriptBlock}
|
||||
|
||||
#Creating the logfile below:
|
||||
Create-LogFile -LogName GetLenovoBiosSettings
|
||||
Write-Log "Grabbing the Bios Settings"
|
||||
Write-Log "Start of Script. Date: $(get-date -UFormat %m-%d-%y)"
|
||||
Write-Log "The original location of this log file is: $LogFile and this file was run on this computer: $ComputerName"
|
||||
|
||||
#Checking PowerShell Version
|
||||
Write-Log "Here is the current running version of PowerShell:"
|
||||
$PSVersionTable
|
||||
|
||||
#$PSVersionTable | Out-File -FilePath $LogFile -Append
|
||||
if ($PSVersionTable.PSVersion.Major -lt 4) {Write-Log "Warning, this script has only been tested on PowerShell 4."}
|
||||
Write-Log
|
||||
Write-Log
|
||||
|
||||
#Checking the ComputerName Parameter, before proceeding.
|
||||
#if (!(Test-Connection $ComputerName -Quiet)) {Write-Log "The computer $ComputerName is not pingable, make sure that it is on.";Break}
|
||||
|
||||
#Just making sure that the computer used is a Lenovo. If it's not, Break the script.
|
||||
if ((Get-WmiObject win32_computersystem -ComputerName $ComputerName).Manufacturer -notmatch "LENOVO") {Write-Log "This computer is not a Lenovo, Breaking now";Break}
|
||||
|
||||
#Instantiating an instance of the lenovo_BIOSsetting wmiobject as a variable. This will be an instance of the currently running config of the BIOS as of the execution of this command.
|
||||
Set-Variable -Name CurrentBIOSSettings -Value (Get-WmiObject lenovo_BIOSsetting -Namespace 'Root\wmi'-ComputerName $ComputerName) -Scope Global
|
||||
|
||||
#Grabbing all of the Bios Settings available.
|
||||
$ALLBiosSettings = $CurrentBiosSettings | Select-Object -ExpandProperty currentsetting | where {$_.length -gt 0} | Sort-Object
|
||||
|
||||
if ($ALLBiosSettings -ne $null) {
|
||||
Write-Log "Below is all of the Bios Settings gathered from $ComputerName :"
|
||||
|
||||
$ALLBiosSettings | Out-File -FilePath $LogFile -Append -Force}
|
||||
if ($ALLBiosSettings -eq $null) { Write-Log "Something went wrong, there are no Bios Settings available."}
|
||||
|
||||
Return $ALLBiosSettings}
|
||||
@@ -0,0 +1,3 @@
|
||||
$ParentRep = Split-Path -Path $PSScriptRoot -Parent
|
||||
|
||||
Import-StartLayout -LayoutPath "$ParentRep\W10_Layout.xml" -MountPath C:\
|
||||
@@ -0,0 +1,128 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Initialise key.bin (clé symétrique) et pwd.sec (mot de passe chiffré) dans un dossier cible.
|
||||
|
||||
.DESCRIPTION
|
||||
Script à exécuter sur une machine sécurisée pour préparer une clé USB contenant:
|
||||
- key.bin : clé symétrique AES-256 au format base64
|
||||
- pwd.sec : mot de passe chiffré (ConvertFrom-SecureString -Key)
|
||||
|
||||
.PARAMETER OutDir
|
||||
Dossier cible où écrire key.bin et pwd.sec. Défaut : dossier courant.
|
||||
|
||||
.PARAMETER UserName
|
||||
(Optionnel) Nom d'utilisateur associé au mot de passe (sera affiché dans le message).
|
||||
|
||||
.PARAMETER Force
|
||||
Écrase les fichiers existants si présent.
|
||||
|
||||
.EXAMPLE
|
||||
.\Init-KeyAndPwd.ps1 -OutDir "E:\" -UserName "EDU\ajoutpc"
|
||||
|
||||
.NOTES
|
||||
Exécuter sur une machine sécurisée. Conserver la clé (key.bin) en sécurité.
|
||||
#>
|
||||
|
||||
param(
|
||||
[string]$OutDir = (Get-Location).Path,
|
||||
[string]$UserName = "EDU\ajoutpc",
|
||||
[switch]$Force
|
||||
)
|
||||
|
||||
function Write-Log {
|
||||
param([string]$msg)
|
||||
$ts = (Get-Date).ToString('yyyy-MM-dd HH:mm:ss')
|
||||
Write-Host "[$ts] $msg"
|
||||
}
|
||||
|
||||
function Set-RestrictiveAcl {
|
||||
param([string]$Path)
|
||||
try {
|
||||
if (-not (Test-Path -Path $Path)) { return }
|
||||
$acl = Get-Acl -Path $Path
|
||||
# Désactiver l'héritage et supprimer règles explicites (best-effort)
|
||||
$acl.SetAccessRuleProtection($true, $false)
|
||||
# Tentative de suppression des règles existantes (peut échouer sur certains supports)
|
||||
$acl.Access | ForEach-Object { $acl.RemoveAccessRule($_) }
|
||||
$admin = New-Object System.Security.Principal.NTAccount("BUILTIN\Administrators")
|
||||
$system = New-Object System.Security.Principal.NTAccount("NT AUTHORITY\SYSTEM")
|
||||
$ruleAdmin = New-Object System.Security.AccessControl.FileSystemAccessRule($admin,"FullControl","None","Allow")
|
||||
$ruleSystem = New-Object System.Security.AccessControl.FileSystemAccessRule($system,"FullControl","None","Allow")
|
||||
$acl.AddAccessRule($ruleAdmin)
|
||||
$acl.AddAccessRule($ruleSystem)
|
||||
Set-Acl -Path $Path -AclObject $acl -ErrorAction Stop
|
||||
Write-Log "ACL restrictive appliquée à $Path"
|
||||
} catch {
|
||||
Write-Log "Impossible d'appliquer ACL restrictive sur $Path : $_"
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
# Normalisation du dossier cible
|
||||
$OutDir = (Resolve-Path -Path $OutDir).Path
|
||||
} catch {
|
||||
Write-Error "Dossier cible invalide : $OutDir"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$keyFile = Join-Path -Path $OutDir -ChildPath "key.bin"
|
||||
$pwdFile = Join-Path -Path $OutDir -ChildPath "pwd.sec"
|
||||
|
||||
# Vérifications
|
||||
if ((Test-Path $keyFile -PathType Leaf -ErrorAction SilentlyContinue) -and -not $Force) {
|
||||
Write-Error "Le fichier key.bin existe déjà dans $OutDir. Utilisez -Force pour écraser."
|
||||
exit 1
|
||||
}
|
||||
if ((Test-Path $pwdFile -PathType Leaf -ErrorAction SilentlyContinue) -and -not $Force) {
|
||||
Write-Error "Le fichier pwd.sec existe déjà dans $OutDir. Utilisez -Force pour écraser."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Génération de la clé (32 octets -> AES-256)
|
||||
Write-Log "Génération de la clé symétrique (AES-256)..."
|
||||
$rng = New-Object System.Security.Cryptography.RNGCryptoServiceProvider
|
||||
$keyBytes = New-Object byte[] 32
|
||||
$rng.GetBytes($keyBytes)
|
||||
$keyB64 = [Convert]::ToBase64String($keyBytes)
|
||||
|
||||
# Écriture du fichier key.bin
|
||||
try {
|
||||
Set-Content -Path $keyFile -Value $keyB64 -Encoding ASCII -Force
|
||||
Write-Log "Clé écrite dans : $keyFile"
|
||||
Set-RestrictiveAcl -Path $keyFile
|
||||
} catch {
|
||||
Write-Error "Erreur lors de l'écriture de key.bin : $_"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Lecture du mot de passe (SecureString) et chiffrement
|
||||
Write-Host ""
|
||||
Write-Host "Saisir le mot de passe à chiffrer pour l'utilisateur : $UserName"
|
||||
$securePass = Read-Host -AsSecureString "Mot de passe (ne s'affiche pas)"
|
||||
|
||||
if (-not $securePass) {
|
||||
Write-Error "Mot de passe non fourni. Abandon."
|
||||
exit 1
|
||||
}
|
||||
|
||||
try {
|
||||
# ConvertFrom-SecureString -Key attend un tableau d'octets
|
||||
$encString = $securePass | ConvertFrom-SecureString -Key $keyBytes
|
||||
Set-Content -Path $pwdFile -Value $encString -Encoding ASCII -Force
|
||||
Write-Log "Mot de passe chiffré écrit dans : $pwdFile"
|
||||
Set-RestrictiveAcl -Path $pwdFile
|
||||
} catch {
|
||||
Write-Error "Erreur lors du chiffrement / écriture du mot de passe : $_"
|
||||
# Tenter de supprimer les fichiers générés pour laisser l'état propre
|
||||
if (Test-Path $keyFile) { Remove-Item -Path $keyFile -Force -ErrorAction SilentlyContinue }
|
||||
if (Test-Path $pwdFile) { Remove-Item -Path $pwdFile -Force -ErrorAction SilentlyContinue }
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Log "Initialisation terminée."
|
||||
Write-Host ""
|
||||
Write-Host "IMPORTANT:"
|
||||
Write-Host " - Déplacez key.bin et pwd.sec sur la clé USB (ou gardez-les ensemble sur la clé)."
|
||||
Write-Host " - PROTÉGEZ la clé USB physiquement et restreignez l'accès au fichier."
|
||||
Write-Host " - Pour tester : copiez les fichiers sur une machine cible et exécutez votre script de join en pointant vers ces fichiers."
|
||||
@@ -0,0 +1,265 @@
|
||||
<#
|
||||
Join-Domain-USB.ps1
|
||||
Usage: placer ce script sur la clé USB avec (optionnel) key.bin + pwd.sec
|
||||
- key.bin : clé symétrique (base64)
|
||||
- pwd.sec : mot de passe chiffré (ConvertFrom-SecureString -Key)
|
||||
Logs -> %SystemRoot%\Logs (ex: C:\Windows\Logs)
|
||||
#>
|
||||
|
||||
# -----------------------
|
||||
# Configuration utilisateur
|
||||
# -----------------------
|
||||
$user_migration_edu = "EDU\ajoutpc"
|
||||
$secteur = "NRD2"
|
||||
|
||||
# Noms de fichiers
|
||||
$keyFileName = "key.bin"
|
||||
$pwdFileName = "pwd.sec"
|
||||
$logPrefix = "migration-log"
|
||||
|
||||
# -----------------------
|
||||
# Déterminer le dossier du script (fonctionne si lancé depuis clé ou ailleurs)
|
||||
# -----------------------
|
||||
# $PSScriptRoot fonctionne quand le script est exécuté depuis un fichier,
|
||||
# sinon on essaie de récupérer via MyInvocation; sinon on prend le répertoire courant.
|
||||
$scriptDir = $null
|
||||
if ($PSScriptRoot) {
|
||||
$scriptDir = $PSScriptRoot
|
||||
} else {
|
||||
try {
|
||||
$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
} catch {
|
||||
$scriptDir = (Get-Location).Path
|
||||
}
|
||||
}
|
||||
if (-not $scriptDir) { $scriptDir = (Get-Location).Path }
|
||||
|
||||
# Emplacements des fichiers sur la clé (ou dossier du script)
|
||||
$keyPath = Join-Path -Path $scriptDir -ChildPath $keyFileName
|
||||
$pwdPath = Join-Path -Path $scriptDir -ChildPath $pwdFileName
|
||||
|
||||
# Emplacement des logs : dossier "Logs" de Windows
|
||||
$windowsLogsDir = Join-Path -Path $env:windir -ChildPath "Logs"
|
||||
if (-not (Test-Path -Path $windowsLogsDir)) {
|
||||
New-Item -Path $windowsLogsDir -ItemType Directory -Force | Out-Null
|
||||
}
|
||||
$logFilePath = Join-Path -Path $windowsLogsDir -ChildPath ("$logPrefix-$(Get-Date -Format 'yyyy-MM-dd').log")
|
||||
|
||||
# -----------------------
|
||||
# Helpers
|
||||
# -----------------------
|
||||
|
||||
function Assert-RunAsAdministrator {
|
||||
$currentIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
$principal = New-Object System.Security.Principal.WindowsPrincipal($currentIdentity)
|
||||
$isAdmin = $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
$isSystem = $currentIdentity.Name -eq 'NT AUTHORITY\SYSTEM'
|
||||
|
||||
Write-LogMessage "Identité courante : $($currentIdentity.Name). IsAdmin=$isAdmin IsSystem=$isSystem"
|
||||
|
||||
if (-not ($isAdmin -or $isSystem)) {
|
||||
throw "Le script doit être exécuté avec des privilèges élevés. Exécution automatique MDT non interactive attendue."
|
||||
}
|
||||
}
|
||||
|
||||
function Write-LogMessage {
|
||||
param([string]$Message, [string]$Type = "INFO")
|
||||
$timestamp = Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
|
||||
$entry = "[$timestamp] [$Type] $Message"
|
||||
try { Add-Content -Path $global:logFilePath -Value $entry -ErrorAction Stop } catch { Write-Output "ERREUR LOG: $($_)"; }
|
||||
Write-Output $entry
|
||||
}
|
||||
|
||||
function Set-RestrictiveAcl {
|
||||
param([string]$Path)
|
||||
try {
|
||||
$acl = Get-Acl -Path $Path
|
||||
$acl.SetAccessRuleProtection($true, $false)
|
||||
# Remove existing explicit rules (best-effort)
|
||||
$acl.Access | ForEach-Object { $acl.RemoveAccessRule($_) }
|
||||
$admin = New-Object System.Security.Principal.NTAccount("BUILTIN\Administrators")
|
||||
$system = New-Object System.Security.Principal.NTAccount("NT AUTHORITY\SYSTEM")
|
||||
$ruleAdmin = New-Object System.Security.AccessControl.FileSystemAccessRule($admin,"FullControl","None","Allow")
|
||||
$ruleSystem = New-Object System.Security.AccessControl.FileSystemAccessRule($system,"FullControl","None","Allow")
|
||||
$acl.AddAccessRule($ruleAdmin)
|
||||
$acl.AddAccessRule($ruleSystem)
|
||||
Set-Acl -Path $Path -AclObject $acl
|
||||
} catch {
|
||||
# sur certaines clés USB, Set-Acl échoue; on ignore mais logguer
|
||||
Write-LogMessage "Impossible d'appliquer ACL restrictive sur $Path : $_" -Type "WARNING"
|
||||
}
|
||||
}
|
||||
|
||||
# -----------------------
|
||||
# Elevation
|
||||
# -----------------------
|
||||
Assert-RunAsAdministrator
|
||||
|
||||
# Créer fichier log si absent
|
||||
if (-not (Test-Path -Path $logFilePath)) { New-Item -Path $logFilePath -ItemType File -Force | Out-Null }
|
||||
Write-LogMessage "Dossier script : $scriptDir"
|
||||
Write-LogMessage "Chemin key : $keyPath"
|
||||
Write-LogMessage "Chemin mot de passe : $pwdPath"
|
||||
|
||||
# -----------------------
|
||||
# Gestion clé et mot de passe (dans dossier du script / clé USB)
|
||||
# -----------------------
|
||||
function New-SymmetricKeyFile {
|
||||
param([string]$OutPath)
|
||||
$rng = New-Object System.Security.Cryptography.RNGCryptoServiceProvider
|
||||
$bytes = New-Object byte[] 32
|
||||
$rng.GetBytes($bytes)
|
||||
$b64 = [Convert]::ToBase64String($bytes)
|
||||
Set-Content -Path $OutPath -Value $b64 -Force
|
||||
Set-RestrictiveAcl -Path $OutPath
|
||||
return $bytes
|
||||
}
|
||||
|
||||
function Get-SymmetricKeyBytes {
|
||||
param([string]$KeyFile)
|
||||
if (-not (Test-Path -Path $KeyFile)) { return $null }
|
||||
try {
|
||||
$b64 = Get-Content -Path $KeyFile -Raw
|
||||
return [Convert]::FromBase64String($b64.Trim())
|
||||
} catch {
|
||||
return $null
|
||||
}
|
||||
}
|
||||
|
||||
function New-EncryptedPasswordFile {
|
||||
param([string]$KeyFile, [string]$PwdFile, [string]$UserName)
|
||||
Write-Host "Fichier mot de passe chiffré absent. Initialisation..."
|
||||
$plain = Read-Host -AsSecureString "Saisir le mot de passe pour $UserName (sera chiffré et stocké sur la clé)"
|
||||
$keyBytes = Get-SymmetricKeyBytes -KeyFile $KeyFile
|
||||
if (-not $keyBytes) { $keyBytes = New-SymmetricKeyFile -OutPath $KeyFile }
|
||||
$enc = $plain | ConvertFrom-SecureString -Key $keyBytes
|
||||
Set-Content -Path $PwdFile -Value $enc -Force
|
||||
Set-RestrictiveAcl -Path $PwdFile
|
||||
Write-LogMessage "Fichier mot de passe chiffré créé sur la clé : $PwdFile"
|
||||
}
|
||||
|
||||
# Si absent, le script ne peut pas fonctionner en mode automatique
|
||||
if (-not (Test-Path -Path $pwdPath) -or -not (Test-Path -Path $keyPath)) {
|
||||
Write-LogMessage "Fichiers requis manquants : $keyPath ou $pwdPath" -Type "ERROR"
|
||||
throw "Les fichiers $keyFileName et $pwdFileName sont obligatoires pour une exécution automatique."
|
||||
}
|
||||
|
||||
# Lire et déchiffrer
|
||||
$keyBytes = Get-SymmetricKeyBytes -KeyFile $keyPath
|
||||
if (-not $keyBytes) {
|
||||
Write-LogMessage "Impossible de lire la clé symétrique ($keyPath)." -Type "ERROR"
|
||||
throw "Clé symétrique manquante ou illisible."
|
||||
}
|
||||
try {
|
||||
$encString = Get-Content -Path $pwdPath -Raw
|
||||
$securePassword = ConvertTo-SecureString $encString -Key $keyBytes
|
||||
} catch {
|
||||
Write-LogMessage "Erreur lors du déchiffrement du mot de passe : $_" -Type "ERROR"
|
||||
throw "Impossible de déchiffrer le mot de passe."
|
||||
}
|
||||
$cred_edu = New-Object System.Management.Automation.PSCredential -ArgumentList $user_migration_edu, $securePassword
|
||||
|
||||
# -----------------------
|
||||
# OU / UAI (inchangé)
|
||||
# -----------------------
|
||||
$OuSites = @{
|
||||
"009" = "009-Labbe-LaMadeleine"; "027" = "027-VertesFeuilles-StAndreLille"; "073" = "073-StExupery-Halluin";
|
||||
"074" = "074-Magny-LyslezLannoy"; "075" = "075-Mongy-MarcqenBaroeul"; "076" = "076-Europeenne-MarcqenBaroeul";
|
||||
"077" = "077-Kernanec-MarcqenBaroeul"; "078" = "078-Loucheur-Roubaix"; "079" = "079-Baudelaire-Roubaix";
|
||||
"080" = "080-Rostand-Roubaix"; "081" = "081-Moulin-Roubaix"; "082" = "082-Turgot-Roubaix";
|
||||
"083" = "083-Lavoisier-Roubaix"; "084" = "084-Meersch-Roubaix"; "085" = "085-Esaat-Roubaix";
|
||||
"087" = "087-Corbusier-Tourcoing"; "089" = "089-Gambetta-Tourcoing"; "090" = "090-Colbert-Tourcoing";
|
||||
"091" = "091-Sevigne-Tourcoing"; "092" = "092-Derycke-VilleneuvedAscq"; "093" = "093-Queneau-VilleneuvedAscq";
|
||||
"094" = "094-Cousteau-Wasquehal"; "095" = "095-Zola-Wattrelos"; "096" = "096-Savary-Wattrelos"
|
||||
}
|
||||
$OuUAI = @{
|
||||
"009" = "0590122M"; "027" = "0592832H"; "073" = "0592850C"; "074" = "0594380R"; "075" = "0590144L";
|
||||
"076" = "0597100X"; "077" = "0590143K"; "078" = "0590187H"; "079" = "0590182C"; "080" = "0590184E";
|
||||
"081" = "0590185F"; "082" = "0590186G"; "083" = "0590189K"; "084" = "0590181B"; "085" = "0594391C";
|
||||
"087" = "0590216P"; "089" = "0590212K"; "090" = "0590214M"; "091" = "0590215N"; "092" = "0594375K";
|
||||
"093" = "0594424N"; "094" = "0590249A"; "095" = "0590233H"; "096" = "0595787V"
|
||||
}
|
||||
|
||||
# -----------------------
|
||||
# Détection hostname / site et jointure domaine (inchangé mais robuste)
|
||||
# -----------------------
|
||||
$hostname = $env:COMPUTERNAME
|
||||
if ($hostname -match '^s20(\d{2})') {
|
||||
$siteNumber = $matches[1]
|
||||
$siteNumberFormatted = "{0:D3}" -f [int]$siteNumber
|
||||
if ($OuSites.ContainsKey($siteNumberFormatted)) {
|
||||
$Site = "02-$siteNumberFormatted"
|
||||
$Ou_site = $OuSites[$siteNumberFormatted]
|
||||
$uai = $OuUAI[$siteNumberFormatted]
|
||||
$Ou = "OU=Pedagogie,OU=$uai,OU=Parc-Informatique,OU=$Ou_site,OU=$secteur,OU=HDF,DC=EDU,DC=HDF"
|
||||
# $dc = "$Site-dc.EDU.HDF"
|
||||
$dc = "999-dc01.EDU.HDF"
|
||||
Write-LogMessage "Traitement du site : $Site avec l'OU : $Ou_site"
|
||||
|
||||
try {
|
||||
$netConfigs = Get-NetIPConfiguration -All -ErrorAction Stop
|
||||
} catch {
|
||||
Write-LogMessage "Impossible de récupérer la configuration IP : $_" -Type "ERROR"
|
||||
throw $_
|
||||
}
|
||||
|
||||
$joined = $false
|
||||
foreach ($cfg in $netConfigs) {
|
||||
foreach ($addr in $cfg.IPv4Address) {
|
||||
$ipv4 = $addr.IPAddress
|
||||
if (-not $ipv4) { continue }
|
||||
Write-LogMessage "IP détectée : $ipv4"
|
||||
$parts = $ipv4.Split('.')
|
||||
if ($parts.Length -lt 4) { Write-LogMessage "IP $ipv4 non conforme." -Type "WARNING"; continue }
|
||||
try { $thirdOctet = [int]$parts[2] } catch { Write-LogMessage "Impossible de parser $ipv4" -Type "WARNING"; continue }
|
||||
|
||||
if ($thirdOctet -ge 192 -and $thirdOctet -le 224) {
|
||||
$isDomain = $false
|
||||
try {
|
||||
$dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
|
||||
if ($dom -and $dom.Name -eq "EDU.HDF") { $isDomain = $true }
|
||||
} catch { $isDomain = $false }
|
||||
|
||||
if (-not $isDomain) {
|
||||
try {
|
||||
$envKey = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
|
||||
$siteExists = Get-ItemProperty -Path $envKey -Name "site" -ErrorAction SilentlyContinue
|
||||
if (-not $siteExists) {
|
||||
New-ItemProperty -Path $envKey -Name "site" -Value $Site -PropertyType String -Force | Out-Null
|
||||
Write-LogMessage "Variable d'environnement 'site' créée : $Site"
|
||||
}
|
||||
} catch { Write-LogMessage "Impossible d'écrire la variable d'environnement 'site' : $_" -Type "WARNING" }
|
||||
|
||||
try {
|
||||
Remove-Computer -UnjoinDomaincredential $cred_edu -WorkgroupName "WORKGROUP" -Force -ErrorAction SilentlyContinue
|
||||
} catch { Write-LogMessage "Remove-Computer NON requis / échoué : $_" -Type "INFO" }
|
||||
|
||||
try {
|
||||
Add-Computer -DomainName "edu.hdf" -Credential $cred_edu -OUPath $Ou -Force -ErrorAction Stop
|
||||
Write-LogMessage "La machine a été ajoutée au domaine $dc avec succès."
|
||||
$joined = $true
|
||||
break
|
||||
} catch {
|
||||
Write-LogMessage "Erreur lors de l'ajout au domaine (interface $ipv4) : $_" -Type "ERROR"
|
||||
}
|
||||
} else {
|
||||
Write-LogMessage "Machine déjà membre du domaine EDU.HDF."
|
||||
$joined = $true
|
||||
break
|
||||
}
|
||||
} else {
|
||||
Write-LogMessage "IP $ipv4 hors des plages autorisées (3ème octet = $thirdOctet)."
|
||||
}
|
||||
}
|
||||
if ($joined) { break }
|
||||
}
|
||||
|
||||
if (-not $joined) { Write-LogMessage "Aucune interface IP valide trouvée pour joindre le domaine." -Type "ERROR" }
|
||||
} else {
|
||||
Write-LogMessage "Le numéro de site $siteNumberFormatted n'est pas dans le tableau d'OU définies." -Type "ERROR"
|
||||
}
|
||||
} else {
|
||||
Write-LogMessage "Hostname ne correspond pas au format attendu (ex: s2009, s2027, s2073 à s2096)." -Type "ERROR"
|
||||
}
|
||||
|
||||
Write-LogMessage "Traitement terminé."
|
||||
@@ -0,0 +1,23 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creation de Key dans le registre pour dire que la configuration WOL est OK
|
||||
|
||||
.DESCRIPTION
|
||||
Cette Key sera vérifié pour exécuter ou non les modifications.
|
||||
|
||||
|
||||
.PARAMETER
|
||||
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
|
||||
.NOTES
|
||||
Auteurs :
|
||||
Aurélien Hamez - Service Exploitation - Secteur Roubaix-Tourcoing
|
||||
Région Hauts de France
|
||||
#>
|
||||
|
||||
|
||||
New-Item "HKLM:\SOFTWARE" -Name SupportHDFKey
|
||||
New-ItemProperty "HKLM:\SOFTWARE\SupportHDFKey\" -Name WOL_Config -PropertyType "String" -Value OK
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
Import-Module $PSScriptRoot\Get-InfosEtab.ps1
|
||||
$InfoEtab = Get-InfosEtab
|
||||
$MDTDns = $InfoEtab.Mdtdns
|
||||
$UNC_MDT = '\\' + $MDTDns + '\mdt$\Scripts'
|
||||
|
||||
$user = $MDTDns + '\MDT-Depl'
|
||||
$key = $PSScriptRoot + "\Credentials\MDT-Depl\key.txt"
|
||||
$SecureKey = ConvertTo-SecureString (Get-Content $key) -AsPlainText -Force
|
||||
$mdp = $PSScriptRoot + "\Credentials\MDT-Depl\mdtdepl-CryptPwd.txt"
|
||||
$password = ConvertTo-SecureString -SecureKey $SecureKey -string (Get-Content $mdp)
|
||||
$credential = New-Object -TypeName system.Management.Automation.PSCredential -ArgumentList $user,$password
|
||||
|
||||
New-PSdrive -name Z -root $UNC_MDT -PSProvider FileSystem -credential $credential
|
||||
|
||||
cscript LiteTouch.vbs
|
||||
@@ -0,0 +1,12 @@
|
||||
$getInfoEtab = Get-InfosEtab
|
||||
$Domain = $getInfoEtab.DnsDomainName
|
||||
|
||||
$ParentRep = Split-Path -Path $PSScriptRoot -Parent
|
||||
|
||||
$user = $env:COMPUTERNAME + '\mdt-depl'
|
||||
$SecureKey = ConvertTo-SecureString (Get-Content $ParentRep\Credential\MDT\Key.txt) -AsPlainText -Force
|
||||
$password = ConvertTo-SecureString -SecureKey $SecureKey -string (Get-Content $ParentRep\Credential\MDT\mdtdepl-CryptPwd.txt)
|
||||
#$password = ConvertTo-SecureString -string $getInfoEtab.WinadminMDP -AsPlainText -Force
|
||||
$credential = New-Object -TypeName system.Management.Automation.PSCredential -ArgumentList $user,$password
|
||||
|
||||
Remove-Computer -ComputerName $env:computername -UnjoinDomainCredential $credential -WorkgroupName WG -Force -PassThru
|
||||
@@ -0,0 +1,15 @@
|
||||
#powershell -noprofile -command "Set-ExecutionPolicy bypass LocalMachine"
|
||||
|
||||
# On met l'adresse du client en variable
|
||||
$IP = ((Test-Connection $env:COMPUTERNAME -Count 1).IPV4Address).ipaddresstostring
|
||||
|
||||
# Nslookup sur $IP
|
||||
$nomfqdn = (nslookup $IP | Select-String "$IP" -Context 1,0).Context.precontext.substring(9)
|
||||
|
||||
# Retrait du groupe et du domain
|
||||
$nonpc = $nomfqdn.Substring(0,$nomfqdn.IndexOf("."))
|
||||
|
||||
# Renommage du PC
|
||||
Rename-Computer -NewName "$nonpc"
|
||||
|
||||
#restart-computer
|
||||
@@ -0,0 +1,48 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
La fonction Get-InfosEtab récupère l'adresse IP du serveur Kaspersky au sein de l'EPLE.
|
||||
|
||||
.DESCRIPTION
|
||||
La fonction Get-InfosEtab récupère l'adresse IP du serveur Kaspersky en utilisant la résolution de nom DNS.
|
||||
Le paramètre <-verbose> indique des informations supplémentaires.
|
||||
|
||||
.PARAMETER
|
||||
<Dssip> chaine de caractère définissant le nom du serveur Kaspersky.
|
||||
Ce paramètre est facultatif, (Dans ce cas, le nom du serveur Wapt est 'debwaptsrv'
|
||||
|
||||
.EXAMPLE
|
||||
Get-InfosEtab <Dssip>
|
||||
|
||||
.NOTES
|
||||
Auteurs :
|
||||
Patrick Pattyn et Aurélien Hamez - UTIL Secteur 2
|
||||
Région Hauts de France
|
||||
#>
|
||||
|
||||
Import-Module $PSScriptRoot\Get-InfosEtab.ps1
|
||||
|
||||
$infoEtab = Get-InfosEtab
|
||||
|
||||
# On autorise l'exécution du script
|
||||
|
||||
|
||||
# Route vers le 10.0.14.0
|
||||
New-NetRoute -InterfaceAlias LAN_Peda -DestinationPrefix 10.0.14.0/24 -AddressFamily IPv4 -NextHop $infoEtab.Ciscoip
|
||||
|
||||
# Route vers le 10.13.14.0
|
||||
New-NetRoute -InterfaceAlias LAN_Peda -DestinationPrefix 10.13.14.0/24 -AddressFamily IPv4 -NextHop $infoEtab.Ciscoip
|
||||
|
||||
# Route vers le 10.43.14.0
|
||||
New-NetRoute -InterfaceAlias LAN_Peda -DestinationPrefix 10.43.14.0/24 -AddressFamily IPv4 -NextHop $infoEtab.Ciscoip
|
||||
|
||||
# Route vers le 10.55.14.0
|
||||
New-NetRoute -InterfaceAlias LAN_Peda -DestinationPrefix 10.55.14.0/24 -AddressFamily IPv4 -NextHop $infoEtab.Ciscoip
|
||||
|
||||
# Route vers le 10.85.14.0
|
||||
New-NetRoute -InterfaceAlias LAN_Peda -DestinationPrefix 10.85.14.0/24 -AddressFamily IPv4 -NextHop $infoEtab.Ciscoip
|
||||
|
||||
# Route vers le 10.125.14.0
|
||||
New-NetRoute -InterfaceAlias LAN_Peda -DestinationPrefix 10.125.14.0/24 -AddressFamily IPv4 -NextHop $infoEtab.Ciscoip
|
||||
|
||||
# Route vers le 10.168.14.0
|
||||
New-NetRoute -InterfaceAlias LAN_Peda -DestinationPrefix 10.168.14.0/24 -AddressFamily IPv4 -NextHop $infoEtab.Ciscoip
|
||||
@@ -0,0 +1,221 @@
|
||||
Function Set-LenovoBIOSSettings {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Set Lenovo BIOS Settings
|
||||
(Set-LenovoBIOSSettings) is a function which can set bios settings for any particular lenovo-based computer which is running PowerShell version 4 or greater.
|
||||
|
||||
.DESCRIPTION
|
||||
Set-LenovoBIOSSettings by default will attempt to apply BIOS settings on the computer the script is running on. This behavior can be changed by specifying the $ComputerName parameter.The $SettingsToBeApplied parameter must take in either a string, or a list of strings. The strings that you apply to the $SettingsToBeApplied parameter must be very specific in order for the Lenovo wmi objects to accept them. That is why there is the Get-LenovoBIOSSettings helper function. You feed some of the output from Get-LenovoBIOSSettings to Set_LenovoBIOSSettings. More information in the help section of Get_LenovoBIOSSettings.
|
||||
|
||||
.PARAMETER computername
|
||||
$ComputerName specifies which computer you would like to alter in terms of BIOS settings.
|
||||
|
||||
.PARAMETER SettingsToBeApplied
|
||||
$SettingsToBeApplied specifies the settings that should be applied. To get correct settings\format of the settings, please see the full help section in Get-LenovoBIOSSettings.
|
||||
|
||||
.EXAMPLE
|
||||
Here is an example of specifying only one setting:
|
||||
Set-LenovoBIOSSettings -ComputerName Some-PC -SettingsToBeApplied "Boot Agent,PXE;[Optional:Disabled,PXE]"
|
||||
|
||||
.EXAMPLE
|
||||
Here is an example of specifying a list of settings, which is most likely what you are going to be doing:
|
||||
Set-LenovoBIOSSettings -ComputerName Some-PC -SettingsToBeApplied "Boot Agent,PXE;[Optional:Disabled,PXE]","Boot Mode,Auto;[Optional:Auto,UEFI,Legacy]","Allow Flashing BIOS to a Previous Version,No;[Optional:No,Yes]"
|
||||
|
||||
.EXAMPLE
|
||||
Obviously you can save the list of settings as a variable and then feed that variable to the function which makes it easier to read:
|
||||
$Settings = "Boot Agent,PXE;[Optional:Disabled,PXE]","Boot Mode,Auto;[Optional:Auto,UEFI,Legacy]","Allow Flashing BIOS to a Previous Version,No;[Optional:No,Yes]"
|
||||
Set-LenovoBIOSSettings -ComputerName Some-PC -SettingsToBeApplied $Settings
|
||||
|
||||
.LINK
|
||||
http://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles_pdf/sb_deploy.pdf
|
||||
https://adameyob.com/2014/11/deploy-lenovo-bios-settings/
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=0)]
|
||||
[string]$ComputerName = (Get-Content env:computername),
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=1)]
|
||||
$SettingsToBeApplied)
|
||||
|
||||
#Defining Write-Log and Create-LogFile within the Function, to make logging easier.
|
||||
|
||||
Function Create-LogFile{
|
||||
[CmdletBinding()]
|
||||
|
||||
param([Parameter(Mandatory=$true, ValueFromPipeline=$true,Position=0)]
|
||||
[string]$LogName,
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=1)]
|
||||
[string]$LogfileVarName = 'LogFile',
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=2)]
|
||||
[string]$LogFileScope = 'Global')
|
||||
|
||||
$LogFileString = "c:\windows\logs\$($LogName)_$(get-date -UFormat %m-%d-%y).log"
|
||||
|
||||
if (Test-Path $LogFileString){Remove-Item -Path $LogFileString -Force}
|
||||
Set-Variable -Name $LogfileVarName -Value $LogFileString -Scope $LogFileScope -Force}
|
||||
|
||||
Function Write-Log {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=0)]
|
||||
[string]$message,
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=1)]
|
||||
[string]$LogName = "REPLACE",
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=2)]
|
||||
[string]$LogfileVarName = 'LogFile',
|
||||
|
||||
[Parameter(Mandatory=$false, ValueFromPipeline=$true,Position=3)]
|
||||
[string]$LogFileScope = 'Global')
|
||||
|
||||
#The Messaging Script Block, to be executed only if $LogFile exists.
|
||||
$MessageScriptBlock = {
|
||||
|
||||
# Call Write-Log followed by a qouted message to log it in the log file and display it on the screen.
|
||||
#Some output will not display on the host screen, but will display on the log file.
|
||||
|
||||
if ($message.Length -eq 0){
|
||||
Write-Host " "
|
||||
" "| Out-File -FilePath $LogFile -Force -Append; Return}
|
||||
|
||||
if ($message -ne $null) {
|
||||
|
||||
$message = "--"+ $message + " - $(Get-Date -Format "hh:mm:ss tt")--"
|
||||
|
||||
Write-Host $message
|
||||
|
||||
$message | Out-File -FilePath $LogFile -Force -Append}}
|
||||
|
||||
if ((Get-Variable $LogfileVarName) -eq $null) {
|
||||
|
||||
if ((Get-Command -Name Create-LogFile) -ne $null) {Create-LogFile -LogName $LogName}
|
||||
|
||||
else {
|
||||
Write-Host "There is no log file nor is there a `"Create-LogFile`" Function available"
|
||||
Write-Host "Creating a Logfile to continue the script: c:\windows\logs\REPLACE.log"
|
||||
|
||||
$LogFileString = "c:\windows\logs\REPLACE.log"
|
||||
|
||||
if (Test-Path $LogFileString){Remove-Item -Path $LogFileString -Force}
|
||||
Set-Variable -Name $LogfileVarName -Value $LogFileString -Scope $LogFileScope -Force}}
|
||||
|
||||
Invoke-Command -ScriptBlock $MessageScriptBlock}
|
||||
|
||||
#Creating the logfile below:
|
||||
Create-LogFile -LogName SetLenovoBiosSettings
|
||||
Write-Log "Updating the Bios Settings"
|
||||
Write-Log "Start of Script. Date: $(get-date -UFormat %m-%d-%y)"
|
||||
Write-Log "The original location of this log file is: $LogFile and this file was run on this computer: $ComputerName"
|
||||
|
||||
#Checking PowerShell Version
|
||||
Write-Log "Here is the current running version of PowerShell:"
|
||||
$PSVersionTable
|
||||
|
||||
#$PSVersionTable | Out-File -FilePath $LogFile -Append
|
||||
if ($PSVersionTable.PSVersion.Major -lt 4) {Write-Log "Warning, this script has only been tested on PowerShell 4."}
|
||||
Write-Log
|
||||
Write-Log
|
||||
Write-Log "Here is the input parameter: `$SettingsToBeApplied: `"$SettingsToBeApplied`""
|
||||
|
||||
#Checking the ComputerName Parameter, before proceeding.
|
||||
if (!(Test-Connection $ComputerName -Quiet)) {Write-Log "The computer $ComputerName is not pingable, make sure that it is on.";Break}
|
||||
|
||||
#Just making sure that the computer used is a Lenovo. If it's not, Break the script.
|
||||
if ((Get-WmiObject win32_computersystem -ComputerName $ComputerName).Manufacturer -notmatch "LENOVO") {Write-Log "This computer is not a Lenovo, Breaking now";Break}
|
||||
|
||||
#Instantiating an instance of the lenovo_BIOSsetting wmiobject as a variable. This will be an instance of the currently running config of the BIOS.
|
||||
Set-Variable -Name CurrentBIOSSettings -Value (Get-WmiObject lenovo_BIOSsetting -Namespace 'Root\wmi'-ComputerName $ComputerName) -Scope Global
|
||||
|
||||
#This allows us to declare\set BIOS settings on an instance of the lenovo_setBIOSsetting wmi object, which can later be applied\saved to the BIOS.
|
||||
if ((Get-Variable -Name BIOSSettings) -eq $null) {Set-Variable -Name BIOSSettings -Value (Get-WmiObject lenovo_setBIOSsetting -namespace root\wmi -ComputerName $ComputerName) -Scope Global}
|
||||
Write-Log "There is a total of $($SettingsToBeApplied.Count) setting(s) to be configured:"
|
||||
|
||||
$index = 1
|
||||
|
||||
Write-Log
|
||||
Write-Log
|
||||
|
||||
$SetBIOSSettingScriptBlock = {
|
||||
|
||||
param([string]$SettingToBeApplied)
|
||||
<#
|
||||
$SetBIOSSettingScriptBlock is defined to apply only one Bios Setting at a time. But because the parent Set_LenovoBIOSSettings function is designed to handle both single Settings,
|
||||
and lists of settings, this script block will be used later on in an if\else block where this script block will be used normally for a single setting, but will be used in a
|
||||
foreach loop in case the function is fed a list of settings\strings.
|
||||
#>
|
||||
|
||||
#Grabbing the Setting Name from the string which contains both the value and the name to make querying simpler, as we do not know what the value currently is.
|
||||
$SettingName = $SettingToBeApplied.split(",")[0]
|
||||
Write-Log
|
||||
Write-Log
|
||||
Write-Log
|
||||
Write-Log
|
||||
Write-Log "$index. Configuring $SettingName"
|
||||
|
||||
Set-Variable -Name index -Value ($index += 1) -Scope 1
|
||||
|
||||
#Saving the value currently applied to this BIOS setting to a variable for easier use.
|
||||
$CurrentBIOSSetting = $CurrentBIOSSettings | where {($_.currentsetting).split(",")[0] -eq $SettingName} | Select-Object -Property CurrentSetting
|
||||
|
||||
#Checking the $SettingToBeApplied parameter.
|
||||
Write-Log "Checking the `$SettingName variable, which is: `"$SettingName`", to make sure that the setting exists in the BIOS."
|
||||
if ($CurrentBIOSSetting -eq $null) {Write-Log "The BIOS does not contain $SettingName as one of it's configurable BIOS Settings.";Return}
|
||||
|
||||
#Logging the current value for this setting.
|
||||
Write-Log "Here is the currently running configuration for this setting:"
|
||||
$CurrentBIOSSetting | Out-File -FilePath $LogFile -Append -Force
|
||||
|
||||
#If the CurrentBIOSSetting is different than what we want it to be,
|
||||
if ($CurrentBIOSSetting.CurrentSetting -ne $SettingToBeApplied) {
|
||||
Write-Log "Trying to apply the Setting: $SettingToBeApplied now."
|
||||
$SuccessCode = $BIOSSettings.SetBIOSSetting($SettingToBeApplied).return
|
||||
|
||||
#If the setting does not apply to this machine, or if the values are not correctly specified, then the success code would be equivalent to "Invalid Parameter".
|
||||
if ($SuccessCode -eq "Invalid Parameter") {Write-Log "The setting: `"$SettingToBeApplied`" is not properly configured for this Machine\BIOS version."}
|
||||
|
||||
#If the setting applied successfully, the success code would be equivalent to "Success"
|
||||
elseif ($SuccessCode -eq "Success") {
|
||||
Write-Log "Successfully applied the setting, below is the newly configured value for this particluar setting:"
|
||||
|
||||
#Grabing the latest instance of the BIOS setting object to log it's new value for confirmation\troubleshooting.
|
||||
Get-WmiObject lenovo_BIOSsetting -Namespace 'Root\wmi' -ComputerName $ComputerName | where {$($_.CurrentSetting.split(',')[0]) -eq $SettingName} | Select-Object -Property CurrentSetting | Out-File -FilePath $LogFile -Append}}
|
||||
|
||||
#If the setting to be applied is the same as the current running config of the bios, log it.
|
||||
if ($CurrentBIOSSetting.CurrentSetting -eq $SettingToBeApplied) {
|
||||
|
||||
Write-Log "The BIOS is already configured correctly. Below is the current values for both variables:"
|
||||
Write-Log "`"`$CurrentBIOSSetting.currentSetting`" is:"
|
||||
Write-Log
|
||||
|
||||
$CurrentBIOSSetting.CurrentSetting | Out-File -FilePath $LogFile -Append -Force
|
||||
|
||||
Write-Log
|
||||
Write-Log "`"`$SettingToBeApplied`" is:"
|
||||
Write-Log
|
||||
|
||||
$SettingToBeApplied | Out-File -FilePath $LogFile -Append -Force}
|
||||
|
||||
((Get-WmiObject lenovo_savebiossettings -ComputerName $ComputerName -Namespace root\wmi).savebiossettings()).return}
|
||||
|
||||
if (($SettingsToBeApplied -isnot [string]) -and ($SettingsToBeApplied -isnot [array])) {$SettingsToBeApplied = $SettingsToBeApplied.tostring()}
|
||||
|
||||
if (($SettingsToBeApplied -is [string]) -and ($SettingsToBeApplied -match ",")) {Invoke-Command -ScriptBlock $SetBIOSSettingScriptBlock -ArgumentList $SettingsToBeApplied}
|
||||
|
||||
if ($SettingsToBeApplied -is [array]) {
|
||||
|
||||
foreach ($SettingToBeApplied in $SettingsToBeApplied) {
|
||||
|
||||
#Below is just some more error checking, making sure the input is correct
|
||||
if (($SettingToBeApplied -isnot [string]) -or (($SettingToBeApplied -is [string]) -and ($SettingsToBeApplied -notmatch ","))) {
|
||||
|
||||
Write-Log "Each object defined in the array as the SettingsToBeApplied paramter must be a string containing at least one comma to differentiate a setting name from it's corresponding value."
|
||||
Write-Log "The object: $SettingToBeApplied which is found at index#$($SettingsToBeApplied.IndexOf($SettingToBeApplied)) of the `"$SettingsToBeApplied`" fails meet the criteria. "}
|
||||
|
||||
#Applying the BIOS Settings below.
|
||||
elseif (($SettingToBeApplied -is [string]) -and ($SettingToBeApplied -match ",")) {Invoke-Command -ScriptBlock $SetBIOSSettingScriptBlock -ArgumentList $SettingToBeApplied}}}}
|
||||
@@ -0,0 +1,251 @@
|
||||
#This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos.
|
||||
#Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc.
|
||||
|
||||
#This is the switch parameter for running this script as a 'silent' script, for use in MDT images or any type of mass deployment without user interaction.
|
||||
|
||||
param (
|
||||
[switch]$Debloat, [switch]$SysPrep
|
||||
)
|
||||
|
||||
Function Begin-SysPrep {
|
||||
|
||||
param([switch]$SysPrep)
|
||||
Write-Verbose -Message ('Starting Sysprep Fixes')
|
||||
|
||||
# Disable Windows Store Automatic Updates
|
||||
<# Write-Verbose -Message "Adding Registry key to Disable Windows Store Automatic Updates"
|
||||
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore"
|
||||
If (!(Test-Path $registryPath)) {
|
||||
Mkdir $registryPath -ErrorAction SilentlyContinue
|
||||
New-ItemProperty $registryPath -Name AutoDownload -Value 2
|
||||
}
|
||||
Else {
|
||||
Set-ItemProperty $registryPath -Name AutoDownload -Value 2
|
||||
}
|
||||
#Stop WindowsStore Installer Service and set to Disabled
|
||||
Write-Verbose -Message ('Stopping InstallService')
|
||||
Stop-Service InstallService
|
||||
#>
|
||||
}
|
||||
|
||||
#Creates a PSDrive to be able to access the 'HKCR' tree
|
||||
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
|
||||
Function Start-Debloat {
|
||||
|
||||
param([switch]$Debloat)
|
||||
|
||||
#Removes AppxPackages
|
||||
#Credit to Reddit user /u/GavinEke for a modified version of my whitelist code
|
||||
[regex]$WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|`
|
||||
Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint|Microsoft.WindowsCamera|.NET|Framework|Microsoft.HEIFImageExtension|Microsoft.ScreenSketch|Microsoft.StorePurchaseApp|`
|
||||
Microsoft.VP9VideoExtensions|Microsoft.WebMediaExtensions|Microsoft.WebpImageExtension|Microsoft.DesktopAppInstaller'
|
||||
Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage -ErrorAction SilentlyContinue
|
||||
# Run this again to avoid error on 1803 or having to reboot.
|
||||
Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage -ErrorAction SilentlyContinue
|
||||
$AppxRemoval = Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps}
|
||||
ForEach ( $App in $AppxRemoval) {
|
||||
|
||||
Remove-AppxProvisionedPackage -Online -PackageName $App.PackageName
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Function Remove-Keys {
|
||||
|
||||
Param([switch]$Debloat)
|
||||
|
||||
#These are the registry keys that it will delete.
|
||||
|
||||
$Keys = @(
|
||||
|
||||
#Remove Background Tasks
|
||||
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
|
||||
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
|
||||
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
|
||||
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
|
||||
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
|
||||
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
|
||||
|
||||
#Windows File
|
||||
"HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
|
||||
|
||||
#Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
|
||||
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
|
||||
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
|
||||
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
|
||||
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
|
||||
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
|
||||
|
||||
#Scheduled Tasks to delete
|
||||
"HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
|
||||
|
||||
#Windows Protocol Keys
|
||||
"HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
|
||||
"HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
|
||||
"HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
|
||||
"HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
|
||||
|
||||
#Windows Share Target
|
||||
"HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
|
||||
)
|
||||
|
||||
#This writes the output of each key it is removing and also removes the keys listed above.
|
||||
ForEach ($Key in $Keys) {
|
||||
Write-Output "Removing $Key from registry"
|
||||
Remove-Item $Key -Recurse -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
Function Protect-Privacy {
|
||||
|
||||
Param([switch]$Debloat)
|
||||
|
||||
#Creates a PSDrive to be able to access the 'HKCR' tree
|
||||
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
|
||||
|
||||
#Disables Windows Feedback Experience
|
||||
Write-Output "Disabling Windows Feedback Experience program"
|
||||
$Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo'
|
||||
If (Test-Path $Advertising) {
|
||||
Set-ItemProperty $Advertising -Name Enabled -Value 0 -Verbose
|
||||
}
|
||||
|
||||
#Stops Cortana from being used as part of your Windows Search Function
|
||||
Write-Output "Stopping Cortana from being used as part of your Windows Search Function"
|
||||
$Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search'
|
||||
If (Test-Path $Search) {
|
||||
Set-ItemProperty $Search -Name AllowCortana -Value 0 -Verbose
|
||||
}
|
||||
|
||||
#Stops the Windows Feedback Experience from sending anonymous data
|
||||
Write-Output "Stopping the Windows Feedback Experience program"
|
||||
$Period1 = 'HKCU:\Software\Microsoft\Siuf'
|
||||
$Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules'
|
||||
$Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds'
|
||||
If (!(Test-Path $Period3)) {
|
||||
mkdir $Period1 -ErrorAction SilentlyContinue
|
||||
mkdir $Period2 -ErrorAction SilentlyContinue
|
||||
mkdir $Period3 -ErrorAction SilentlyContinue
|
||||
New-ItemProperty $Period3 -Name PeriodInNanoSeconds -Value 0 -Verbose -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
Write-Output "Adding Registry key to prevent bloatware apps from returning"
|
||||
#Prevents bloatware applications from returning
|
||||
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
|
||||
If (!(Test-Path $registryPath)) {
|
||||
Mkdir $registryPath -ErrorAction SilentlyContinue
|
||||
New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
Write-Output "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
|
||||
$Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic'
|
||||
If (Test-Path $Holo) {
|
||||
Set-ItemProperty $Holo -Name FirstRunSucceeded -Value 0 -Verbose
|
||||
}
|
||||
|
||||
#Disables live tiles
|
||||
Write-Output "Disabling live tiles"
|
||||
$Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications'
|
||||
If (!(Test-Path $Live)) {
|
||||
mkdir $Live -ErrorAction SilentlyContinue
|
||||
New-ItemProperty $Live -Name NoTileApplicationNotification -Value 1 -Verbose
|
||||
}
|
||||
|
||||
#Turns off Data Collection via the AllowTelemtry key by changing it to 0
|
||||
Write-Output "Turning off Data Collection"
|
||||
$DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection'
|
||||
If (Test-Path $DataCollection) {
|
||||
Set-ItemProperty $DataCollection -Name AllowTelemetry -Value 0 -Verbose
|
||||
}
|
||||
|
||||
#Disables People icon on Taskbar
|
||||
Write-Output "Disabling People icon on Taskbar"
|
||||
$People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
|
||||
If (Test-Path $People) {
|
||||
Set-ItemProperty $People -Name PeopleBand -Value 0 -Verbose
|
||||
}
|
||||
|
||||
#Disables suggestions on start menu
|
||||
Write-Output "Disabling suggestions on the Start Menu"
|
||||
$Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager'
|
||||
If (Test-Path $Suggestions) {
|
||||
Set-ItemProperty $Suggestions -Name SystemPaneSuggestionsEnabled -Value 0 -Verbose
|
||||
}
|
||||
|
||||
|
||||
Write-Output "Removing CloudStore from registry if it exists"
|
||||
# $CloudStore = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore'
|
||||
# If (Test-Path $CloudStore) {
|
||||
# Stop-Process Explorer.exe -Force
|
||||
# Remove-Item $CloudStore -Recurse -Force
|
||||
# Start-Process Explorer.exe -Wait
|
||||
# }
|
||||
|
||||
#Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish
|
||||
reg load HKU\Default_User C:\Users\Default\NTUSER.DAT
|
||||
Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0
|
||||
Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0
|
||||
Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0
|
||||
reg unload HKU\Default_User
|
||||
|
||||
#Disables scheduled tasks that are considered unnecessary
|
||||
Write-Output "Disabling scheduled tasks"
|
||||
#Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask -ErrorAction SilentlyContinue
|
||||
Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask -ErrorAction SilentlyContinue
|
||||
#Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask -ErrorAction SilentlyContinue
|
||||
#Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask -ErrorAction SilentlyContinue
|
||||
Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask -ErrorAction SilentlyContinue
|
||||
Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
#This includes fixes by xsisbest
|
||||
Function FixWhitelistedApps {
|
||||
|
||||
Param([switch]$Debloat)
|
||||
|
||||
If(!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.MSPaint, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.MicrosoftStickyNotes, Microsoft.WindowsSoundRecorder, Microsoft.Windows.Photos)) {
|
||||
|
||||
#Credit to abulgatz for the 4 lines of code
|
||||
Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
|
||||
Get-AppxPackage -allusers Microsoft.MSPaint | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
|
||||
Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
|
||||
Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
|
||||
Get-AppxPackage -allusers Microsoft.MicrosoftStickyNotes | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
|
||||
Get-AppxPackage -allusers Microsoft.WindowsSoundRecorder | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
|
||||
Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} }
|
||||
}
|
||||
|
||||
Function CheckDMWService {
|
||||
|
||||
Param([switch]$Debloat)
|
||||
|
||||
If (Get-Service -Name dmwappushservice | Where-Object {$_.StartType -eq "Disabled"}) {
|
||||
Set-Service -Name dmwappushservice -StartupType Automatic}
|
||||
|
||||
If(Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) {
|
||||
Start-Service -Name dmwappushservice}
|
||||
}
|
||||
|
||||
Function CheckInstallService {
|
||||
Param([switch]$Debloat)
|
||||
If (Get-Service -Name InstallService | Where-Object {$_.Status -eq "Stopped"}) {
|
||||
Start-Service -Name InstallService
|
||||
Set-Service -Name InstallService -StartupType Automatic
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output "Initiating Sysprep"
|
||||
Begin-SysPrep
|
||||
Write-Output "Removing bloatware apps."
|
||||
Start-Debloat
|
||||
Write-Output "Removing leftover bloatware registry keys."
|
||||
Remove-Keys
|
||||
Write-Output "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
|
||||
FixWhitelistedApps
|
||||
Write-Output "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning."
|
||||
Protect-Privacy
|
||||
#Write-Output "Stopping Edge from taking over as the default PDF Viewer."
|
||||
#Stop-EdgePDF
|
||||
CheckDMWService
|
||||
CheckInstallService
|
||||
Write-Output "Finished all tasks."
|
||||
@@ -0,0 +1,12 @@
|
||||
powershell -noprofile -command "Set-ExecutionPolicy bypass LocalMachine"
|
||||
|
||||
#Write-host "Operating system is $OSversion"
|
||||
$kmshost = '10.0.14.20'
|
||||
Write-Host "Le serveur KSM est defini sur $kmshost"
|
||||
#Write-host "KMS client key is $Key"
|
||||
sleep -Seconds 2
|
||||
Write-host 'Forcing activation using slmgr script...'
|
||||
cscript $env:windir\System32\slmgr.vbs /skms $kmshost 2>&1
|
||||
#cscript $env:windir\System32\slmgr.vbs /ipk $key 2>&1
|
||||
cscript $env:windir\System32\slmgr.vbs /ato 2>&1
|
||||
break
|
||||
@@ -0,0 +1,99 @@
|
||||
<#function Get-ActivationStatus {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
|
||||
[string]$DNSHostName = $Env:COMPUTERNAME
|
||||
)
|
||||
process {
|
||||
try {
|
||||
$wpa = Get-WmiObject SoftwareLicensingProduct -ComputerName $DNSHostName `
|
||||
-Filter "ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f'" `
|
||||
-Property LicenseStatus -ErrorAction Stop
|
||||
} catch {
|
||||
$status = New-Object ComponentModel.Win32Exception ($_.Exception.ErrorCode)
|
||||
$wpa = $null
|
||||
}
|
||||
$out = New-Object psobject -Property @{
|
||||
ComputerName = $DNSHostName;
|
||||
Status = [string]::Empty;
|
||||
}
|
||||
if ($wpa) {
|
||||
:outer foreach($item in $wpa) {
|
||||
switch ($item.LicenseStatus) {
|
||||
0 {$out.Status = "Unlicensed"}
|
||||
1 {$out.Status = "Licensed"; break outer}
|
||||
2 {$out.Status = "Out-Of-Box Grace Period"; break outer}
|
||||
3 {$out.Status = "Out-Of-Tolerance Grace Period"; break outer}
|
||||
4 {$out.Status = "Non-Genuine Grace Period"; break outer}
|
||||
5 {$out.Status = "Notification"; break outer}
|
||||
6 {$out.Status = "Extended Grace"; break outer}
|
||||
default {$out.Status = "Unknown value"}
|
||||
}
|
||||
}
|
||||
} else {$out.Status = $status.Message}
|
||||
$out
|
||||
}
|
||||
}
|
||||
Write-Verbose 'Checking if Windows is activated...'
|
||||
sleep -Seconds 1
|
||||
$Licensed = Get-ActivationStatus
|
||||
IF (($Licensed.status -eq 'Licensed') -and (!$Force))
|
||||
{
|
||||
Write-host 'Windows is already activated.'
|
||||
break
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-host 'Windows will be deactivated.'
|
||||
$OSversion = (Get-WmiObject -class Win32_OperatingSystem).Caption
|
||||
switch -Regex ($OSversion) {
|
||||
|
||||
#windows 7
|
||||
'Microsoft Windows 7 Professionnel' {$key = 'FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4';break}
|
||||
'Microsoft Windows 7 Enterprise' {$key = '33PXH-7Y6KF-2VJC9-XBBR8-HVTHH';break}
|
||||
#windows 8
|
||||
'Microsoft Windows 8 Professional' {$key = 'NG4HW-VH26C-733KW-K6F98-J8CK4';break}
|
||||
'Microsoft Windows 8 Enterprise' {$key = '32JNW-9KQ84-P47T8-D8GGY-CWCK7';break}
|
||||
#Windows 8.1
|
||||
'Microsoft Windows 8.1 Professionnel N' {$key = 'HMCNV-VVBFX-7HMBH-CTY9B-B4FXY';break}
|
||||
'Microsoft Windows 8.1 Professionnel' {$key = 'GCRJD-8NW9H-F2CDX-CCM8D-9D6T9';break}
|
||||
'Microsoft Windows 8.1 Enterprise N' {$key = 'TT4HM-HN7YT-62K67-RGRQJ-JFFXW';break}
|
||||
'Microsoft Windows 8.1 Enterprise' {$key = 'MHF9N-XY6XB-WVXMC-BTDCT-MKKG7';break}
|
||||
#Windows 10
|
||||
'Microsoft Windows 10 Éducation' {$Key = 'NW6C2-QMPVW-D7KKK-3GKT6-VCFB2';break}
|
||||
'Microsoft Windows 10 Professionnel' {$Key = 'W269N-WFGWX-YVC9B-4J6C9-T83GX';break}
|
||||
'Microsoft Windows 10 Enterprise' {$Key = 'NPPR9-FWDCX-D2C8J-H872K-2YT43';break}
|
||||
'Microsoft Windows 10 Enterprise 2015 LTSB' {$Key = 'WNMTR-4C88C-JK8YV-HQ7T2-76DF9';break}
|
||||
#Windows Serveur 2008
|
||||
'Microsoft Windows Server 2008 R2 Standard' {$Key = 'YC6KT-GKW9T-YTKYR-T4X34-R7VHC';break}
|
||||
'Microsoft Windows Server 2008 R2 Enterprise' {$Key = '489J6-VHDMP-X63PK-3K798-CPX3Y';break}
|
||||
'Microsoft Windows Server 2008 R2 Datacenter' {$Key = 'W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9';break}
|
||||
'Microsoft Windows Server 2008 R2 Essentials' {$Key = 'KNC87-3J2TX-XB4WP-VCPJV-M4FWM';break}
|
||||
#Windows Serveur 2012
|
||||
'Microsoft Windows Server 2012 R2 Standard' {$key = 'D2N9P-3P6X9-2R39C-7RTCD-MDVJX';break}
|
||||
'Microsoft Windows Server 2012 R2 Datacenter' {$key = 'W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9';break}
|
||||
'Microsoft Windows Server 2008 R2 Enterprise' {$key = '489J6-VHDMP-X63PK-3K798-CPX3Y';break}
|
||||
'Microsoft Windows Server 2012 R2 Essentials' {$key = 'KNC87-3J2TX-XB4WP-VCPJV-M4FWM';break}
|
||||
#Windows Serveur 2016
|
||||
'Microsoft Windows Server 2016 Standard' {$key = 'WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY';break}
|
||||
'Microsoft Windows Server 2016 Datacenter' {$Key = 'CB7KF-BWN84-R7R2Y-793K2-8XDDG';break}
|
||||
'Microsoft Windows Server 2016 Essentials' {$key = 'JCKRF-N37P4-C2D82-9YXRT-4M63B';break}
|
||||
|
||||
}#>
|
||||
#Write-host "Operating system is $OSversion"
|
||||
$kmshost = '10.0.14.20'
|
||||
Write-Host "Le serveur KSM est defini sur $kmshost"
|
||||
#Write-host "KMS client key is $Key"
|
||||
sleep -Seconds 2
|
||||
Write-host 'Forcing activation using slmgr script...'
|
||||
cscript $env:windir\System32\slmgr.vbs /skms $kmshost 2>&1
|
||||
#cscript $env:windir\System32\slmgr.vbs /ipk $key 2>&1
|
||||
cscript $env:windir\System32\slmgr.vbs /ato 2>&1
|
||||
break
|
||||
#}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
|
||||
$RegROPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
|
||||
Write-Host "Run Once Logiciel et configuration" -foreground Magenta
|
||||
Set-ItemProperty $RegROPath "(Default)" -Value "c:\deltemp.cmd" -type String
|
||||
@@ -0,0 +1,36 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Déactivation du démarrage rapide
|
||||
|
||||
.DESCRIPTION
|
||||
0 pour désactiver
|
||||
1 pour activer
|
||||
|
||||
.PARAMETER
|
||||
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
|
||||
.NOTES
|
||||
Auteurs :
|
||||
Aurélien Hamez - Service Exploitation - Secteur Roubaix-Tourcoing
|
||||
Région Hauts de France
|
||||
#>
|
||||
|
||||
$PathKey = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System\"
|
||||
$Key = "HiberbootEnabled"
|
||||
|
||||
$Value = Get-ItemProperty $PathKey -Name $Key -ErrorAction SilentlyContinue
|
||||
if ($Value){
|
||||
$ValueKey = Get-ItemPropertyValue -Path $PathKey -Name $Key
|
||||
If ($ValueKey -ne 0)
|
||||
{
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name HiberbootEnabled -Type DWORD -Value 00000000
|
||||
}
|
||||
}
|
||||
else{
|
||||
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name HiberbootEnabled -Type DWORD -Value 00000000
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# Set a known password
|
||||
$nopassword = $(Start-Process -FilePath "%ScriptRoot%\BiosConfig\Dell\cctk.exe" -ArgumentList "--setuppwd=CRHDF" -NoNewWindow -Wait -PassThru).ExitCode
|
||||
If($nopassword -eq 115) {
|
||||
$pw_array = @("dellintel","smbadmin","CRHDF2020","crhdf","Lvsr59100")
|
||||
foreach($oldBIOSpassword in $pw_array) {
|
||||
$trypassword = $(Start-Process -FilePath ".\cctk.exe" -ArgumentList "--valsetuppwd=$oldBIOSpassword --setuppwd=CRHDF" -NoNewWindow -Wait -PassThru).ExitCode
|
||||
If ($trypassword -eq 0) {
|
||||
Break
|
||||
}
|
||||
}
|
||||
} elseif($nopassword -ne 0) {
|
||||
## catch not 0 error code
|
||||
Write-Host "BIOS is password protected with an unknown password. Cannot continue."
|
||||
Exit $nopassword
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
# Description:
|
||||
# This script will disable certain scheduled tasks. Work in progress!
|
||||
|
||||
$tasks = @(
|
||||
# Windows base scheduled tasks
|
||||
"\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319"
|
||||
"\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 64"
|
||||
"\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 64 Critical"
|
||||
"\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 Critical"
|
||||
|
||||
#"\Microsoft\Windows\Active Directory Rights Management Services Client\AD RMS Rights Policy Template Management (Automated)"
|
||||
#"\Microsoft\Windows\Active Directory Rights Management Services Client\AD RMS Rights Policy Template Management (Manual)"
|
||||
|
||||
#"\Microsoft\Windows\AppID\EDP Policy Manager"
|
||||
#"\Microsoft\Windows\AppID\PolicyConverter"
|
||||
"\Microsoft\Windows\AppID\SmartScreenSpecific"
|
||||
#"\Microsoft\Windows\AppID\VerifiedPublisherCertStoreCheck"
|
||||
|
||||
"\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser"
|
||||
"\Microsoft\Windows\Application Experience\ProgramDataUpdater"
|
||||
#"\Microsoft\Windows\Application Experience\StartupAppTask"
|
||||
|
||||
#"\Microsoft\Windows\ApplicationData\CleanupTemporaryState"
|
||||
#"\Microsoft\Windows\ApplicationData\DsSvcCleanup"
|
||||
|
||||
#"\Microsoft\Windows\AppxDeploymentClient\Pre-staged app cleanup"
|
||||
|
||||
"\Microsoft\Windows\Autochk\Proxy"
|
||||
|
||||
#"\Microsoft\Windows\Bluetooth\UninstallDeviceTask"
|
||||
|
||||
#"\Microsoft\Windows\CertificateServicesClient\AikCertEnrollTask"
|
||||
#"\Microsoft\Windows\CertificateServicesClient\KeyPreGenTask"
|
||||
#"\Microsoft\Windows\CertificateServicesClient\SystemTask"
|
||||
#"\Microsoft\Windows\CertificateServicesClient\UserTask"
|
||||
#"\Microsoft\Windows\CertificateServicesClient\UserTask-Roam"
|
||||
|
||||
#"\Microsoft\Windows\Chkdsk\ProactiveScan"
|
||||
|
||||
#"\Microsoft\Windows\Clip\License Validation"
|
||||
|
||||
"\Microsoft\Windows\CloudExperienceHost\CreateObjectTask"
|
||||
|
||||
"\Microsoft\Windows\Customer Experience Improvement Program\Consolidator"
|
||||
"\Microsoft\Windows\Customer Experience Improvement Program\KernelCeipTask"
|
||||
"\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip"
|
||||
|
||||
#"\Microsoft\Windows\Data Integrity Scan\Data Integrity Scan"
|
||||
#"\Microsoft\Windows\Data Integrity Scan\Data Integrity Scan for Crash Recovery"
|
||||
|
||||
#"\Microsoft\Windows\Defrag\ScheduledDefrag"
|
||||
|
||||
#"\Microsoft\Windows\Diagnosis\Scheduled"
|
||||
|
||||
#"\Microsoft\Windows\DiskCleanup\SilentCleanup"
|
||||
|
||||
"\Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector"
|
||||
#"\Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticResolver"
|
||||
|
||||
#"\Microsoft\Windows\DiskFootprint\Diagnostics"
|
||||
|
||||
"\Microsoft\Windows\Feedback\Siuf\DmClient"
|
||||
|
||||
#"\Microsoft\Windows\File Classification Infrastructure\Property Definition Sync"
|
||||
|
||||
#"\Microsoft\Windows\FileHistory\File History (maintenance mode)"
|
||||
|
||||
#"\Microsoft\Windows\LanguageComponentsInstaller\Installation"
|
||||
#"\Microsoft\Windows\LanguageComponentsInstaller\Uninstallation"
|
||||
|
||||
#"\Microsoft\Windows\Location\Notifications"
|
||||
#"\Microsoft\Windows\Location\WindowsActionDialog"
|
||||
|
||||
#"\Microsoft\Windows\Maintenance\WinSAT"
|
||||
|
||||
#"\Microsoft\Windows\Maps\MapsToastTask"
|
||||
#"\Microsoft\Windows\Maps\MapsUpdateTask"
|
||||
|
||||
#"\Microsoft\Windows\MemoryDiagnostic\ProcessMemoryDiagnosticEvents"
|
||||
#"\Microsoft\Windows\MemoryDiagnostic\RunFullMemoryDiagnostic"
|
||||
|
||||
"\Microsoft\Windows\Mobile Broadband Accounts\MNO Metadata Parser"
|
||||
|
||||
#"\Microsoft\Windows\MUI\LPRemove"
|
||||
|
||||
#"\Microsoft\Windows\Multimedia\SystemSoundsService"
|
||||
|
||||
#"\Microsoft\Windows\NetCfg\BindingWorkItemQueueHandler"
|
||||
|
||||
#"\Microsoft\Windows\NetTrace\GatherNetworkInfo"
|
||||
|
||||
#"\Microsoft\Windows\Offline Files\Background Synchronization"
|
||||
#"\Microsoft\Windows\Offline Files\Logon Synchronization"
|
||||
|
||||
#"\Microsoft\Windows\PI\Secure-Boot-Update"
|
||||
#"\Microsoft\Windows\PI\Sqm-Tasks"
|
||||
|
||||
#"\Microsoft\Windows\Plug and Play\Device Install Group Policy"
|
||||
#"\Microsoft\Windows\Plug and Play\Device Install Reboot Required"
|
||||
#"\Microsoft\Windows\Plug and Play\Plug and Play Cleanup"
|
||||
#"\Microsoft\Windows\Plug and Play\Sysprep Generalize Drivers"
|
||||
|
||||
#"\Microsoft\Windows\Power Efficiency Diagnostics\AnalyzeSystem"
|
||||
|
||||
#"\Microsoft\Windows\Ras\MobilityManager"
|
||||
|
||||
#"\Microsoft\Windows\RecoveryEnvironment\VerifyWinRE"
|
||||
|
||||
#"\Microsoft\Windows\Registry\RegIdleBackup"
|
||||
|
||||
#"\Microsoft\Windows\RemoteAssistance\RemoteAssistanceTask"
|
||||
|
||||
#"\Microsoft\Windows\RemovalTools\MRT_HB"
|
||||
|
||||
#"\Microsoft\Windows\Servicing\StartComponentCleanup"
|
||||
|
||||
#"\Microsoft\Windows\SettingSync\NetworkStateChangeTask"
|
||||
|
||||
#"\Microsoft\Windows\Shell\CreateObjectTask"
|
||||
#"\Microsoft\Windows\Shell\FamilySafetyMonitor"
|
||||
#"\Microsoft\Windows\Shell\FamilySafetyRefresh"
|
||||
#"\Microsoft\Windows\Shell\IndexerAutomaticMaintenance"
|
||||
|
||||
#"\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask"
|
||||
#"\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTaskLogon"
|
||||
#"\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTaskNetwork"
|
||||
|
||||
#"\Microsoft\Windows\SpacePort\SpaceAgentTask"
|
||||
|
||||
#"\Microsoft\Windows\Sysmain\HybridDriveCachePrepopulate"
|
||||
#"\Microsoft\Windows\Sysmain\HybridDriveCacheRebalance"
|
||||
#"\Microsoft\Windows\Sysmain\ResPriStaticDbSync"
|
||||
#"\Microsoft\Windows\Sysmain\WsSwapAssessmentTask"
|
||||
|
||||
#"\Microsoft\Windows\SystemRestore\SR"
|
||||
|
||||
#"\Microsoft\Windows\Task Manager\Interactive"
|
||||
|
||||
#"\Microsoft\Windows\TextServicesFramework\MsCtfMonitor"
|
||||
|
||||
#"\Microsoft\Windows\Time Synchronization\ForceSynchronizeTime"
|
||||
#"\Microsoft\Windows\Time Synchronization\SynchronizeTime"
|
||||
|
||||
#"\Microsoft\Windows\Time Zone\SynchronizeTimeZone"
|
||||
|
||||
#"\Microsoft\Windows\TPM\Tpm-HASCertRetr"
|
||||
#"\Microsoft\Windows\TPM\Tpm-Maintenance"
|
||||
|
||||
#"\Microsoft\Windows\UpdateOrchestrator\Maintenance Install"
|
||||
#"\Microsoft\Windows\UpdateOrchestrator\Policy Install"
|
||||
#"\Microsoft\Windows\UpdateOrchestrator\Reboot"
|
||||
#"\Microsoft\Windows\UpdateOrchestrator\Resume On Boot"
|
||||
#"\Microsoft\Windows\UpdateOrchestrator\Schedule Scan"
|
||||
#"\Microsoft\Windows\UpdateOrchestrator\USO_UxBroker_Display"
|
||||
#"\Microsoft\Windows\UpdateOrchestrator\USO_UxBroker_ReadyToReboot"
|
||||
|
||||
#"\Microsoft\Windows\UPnP\UPnPHostConfig"
|
||||
|
||||
#"\Microsoft\Windows\User Profile Service\HiveUploadTask"
|
||||
|
||||
#"\Microsoft\Windows\WCM\WiFiTask"
|
||||
|
||||
#"\Microsoft\Windows\WDI\ResolutionHost"
|
||||
|
||||
"\Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance"
|
||||
"\Microsoft\Windows\Windows Defender\Windows Defender Cleanup"
|
||||
"\Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan"
|
||||
"\Microsoft\Windows\Windows Defender\Windows Defender Verification"
|
||||
|
||||
"\Microsoft\Windows\Windows Error Reporting\QueueReporting"
|
||||
|
||||
#"\Microsoft\Windows\Windows Filtering Platform\BfeOnServiceStartTypeChange"
|
||||
|
||||
#"\Microsoft\Windows\Windows Media Sharing\UpdateLibrary"
|
||||
|
||||
#"\Microsoft\Windows\WindowsColorSystem\Calibration Loader"
|
||||
|
||||
#"\Microsoft\Windows\WindowsUpdate\Automatic App Update"
|
||||
#"\Microsoft\Windows\WindowsUpdate\Scheduled Start"
|
||||
#"\Microsoft\Windows\WindowsUpdate\sih"
|
||||
#"\Microsoft\Windows\WindowsUpdate\sihboot"
|
||||
|
||||
#"\Microsoft\Windows\Wininet\CacheTask"
|
||||
|
||||
#"\Microsoft\Windows\WOF\WIM-Hash-Management"
|
||||
#"\Microsoft\Windows\WOF\WIM-Hash-Validation"
|
||||
|
||||
#"\Microsoft\Windows\Work Folders\Work Folders Logon Synchronization"
|
||||
#"\Microsoft\Windows\Work Folders\Work Folders Maintenance Work"
|
||||
|
||||
#"\Microsoft\Windows\Workplace Join\Automatic-Device-Join"
|
||||
|
||||
#"\Microsoft\Windows\WS\License Validation"
|
||||
#"\Microsoft\Windows\WS\WSTask"
|
||||
|
||||
# Scheduled tasks which cannot be disabled
|
||||
#"\Microsoft\Windows\Device Setup\Metadata Refresh"
|
||||
#"\Microsoft\Windows\SettingSync\BackgroundUploadTask"
|
||||
)
|
||||
|
||||
foreach ($task in $tasks) {
|
||||
$parts = $task.split('\')
|
||||
$name = $parts[-1]
|
||||
$path = $parts[0..($parts.length-2)] -join '\'
|
||||
|
||||
Disable-ScheduledTask -TaskName "$name" -TaskPath "$path" -ErrorAction SilentlyContinue
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
|
||||
@@ -0,0 +1,183 @@
|
||||
<#
|
||||
Installation Chocolatey + logiciels
|
||||
Optimisé MDT USB / Windows 11 25H2
|
||||
Gestion timeout + retry
|
||||
#>
|
||||
|
||||
#region CONFIGURATION
|
||||
|
||||
$LogFile = "C:\Windows\Temp\choco_install.log"
|
||||
|
||||
$GlobalTimeoutMinutes = 180
|
||||
$PackageTimeoutSeconds = 2700
|
||||
$RetryCount = 2
|
||||
|
||||
$Packages = @(
|
||||
"chocolatey-core.extension",
|
||||
"chocolatey-compatibility.extension",
|
||||
"chocolatey-windowsupdate.extension",
|
||||
|
||||
"7zip.install",
|
||||
"googlechrome",
|
||||
"firefoxesr",
|
||||
"microsoft-edge",
|
||||
"notepadplusplus.install",
|
||||
"vlc.install",
|
||||
"foxitreader",
|
||||
"libreoffice-fresh",
|
||||
|
||||
"vcredist140"
|
||||
)
|
||||
|
||||
#endregion
|
||||
|
||||
#region LOGGING
|
||||
|
||||
function Write-Log {
|
||||
|
||||
param ([string]$Message)
|
||||
|
||||
$Time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||
|
||||
$Entry = "$Time - $Message"
|
||||
|
||||
Write-Output $Entry
|
||||
Add-Content $LogFile $Entry
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GLOBAL TIMER
|
||||
|
||||
$ScriptStartTime = Get-Date
|
||||
|
||||
function Test-GlobalTimeout {
|
||||
|
||||
$Elapsed = (Get-Date) - $ScriptStartTime
|
||||
|
||||
if ($Elapsed.TotalMinutes -gt $GlobalTimeoutMinutes) {
|
||||
|
||||
Write-Log "GLOBAL TIMEOUT atteint"
|
||||
|
||||
exit 1
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PREREQUIS
|
||||
|
||||
Write-Log "Verification prerequis"
|
||||
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||
|
||||
[System.Net.ServicePointManager]::SecurityProtocol =
|
||||
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||
|
||||
#endregion
|
||||
|
||||
#region INSTALL CHOCOLATEY
|
||||
|
||||
if (!(Get-Command choco -ErrorAction SilentlyContinue)) {
|
||||
|
||||
Write-Log "Installation Chocolatey"
|
||||
|
||||
Invoke-Expression (
|
||||
(New-Object System.Net.WebClient).DownloadString(
|
||||
"https://community.chocolatey.org/install.ps1"
|
||||
)
|
||||
)
|
||||
|
||||
refreshenv
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Log "Chocolatey deja installe"
|
||||
|
||||
}
|
||||
|
||||
choco feature enable -n allowGlobalConfirmation
|
||||
|
||||
#endregion
|
||||
|
||||
#region INSTALL FUNCTION WITH TIMEOUT
|
||||
|
||||
function Install-PackageWithTimeout {
|
||||
|
||||
param (
|
||||
[string]$PackageName
|
||||
)
|
||||
|
||||
for ($i = 1; $i -le $RetryCount; $i++) {
|
||||
|
||||
Test-GlobalTimeout
|
||||
|
||||
Write-Log "Installation $PackageName tentative $i"
|
||||
|
||||
$Process = Start-Process `
|
||||
choco `
|
||||
-ArgumentList "install $PackageName -y --no-progress" `
|
||||
-PassThru `
|
||||
-WindowStyle Hidden
|
||||
|
||||
if ($Process.WaitForExit($PackageTimeoutSeconds * 1000)) {
|
||||
|
||||
if ($Process.ExitCode -eq 0) {
|
||||
|
||||
Write-Log "Succes $PackageName"
|
||||
return
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Log "Erreur code $($Process.ExitCode)"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Log "Timeout $PackageName"
|
||||
|
||||
try {
|
||||
$Process.Kill()
|
||||
}
|
||||
catch {}
|
||||
|
||||
}
|
||||
|
||||
Start-Sleep 10
|
||||
|
||||
}
|
||||
|
||||
Write-Log "Echec final $PackageName"
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INSTALLATION PACKAGES
|
||||
|
||||
foreach ($Package in $Packages) {
|
||||
|
||||
Install-PackageWithTimeout $Package
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UPGRADE FINAL
|
||||
|
||||
Write-Log "Upgrade global"
|
||||
|
||||
choco upgrade all -y --no-progress
|
||||
|
||||
#endregion
|
||||
|
||||
Write-Log "Script termine"
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,262 @@
|
||||
<#
|
||||
Script PowerShell - Installation Chocolatey avec cache local
|
||||
Optimisé pour MDT USB / Windows 11 25H2
|
||||
Utilise un dossier local 'softwares' pour accélérer l'installation
|
||||
Fallback automatique vers Internet si package absent
|
||||
Gestion timeout + retry + logs
|
||||
#>
|
||||
|
||||
#region CONFIGURATION
|
||||
|
||||
$LogFile = "C:\Windows\Temp\choco_install.log"
|
||||
|
||||
$GlobalTimeoutMinutes = 180
|
||||
$PackageTimeoutSeconds = 2700
|
||||
$RetryCount = 2
|
||||
|
||||
# Dossier local contenant les packages .nupkg
|
||||
$LocalRepo = Join-Path $PSScriptRoot "softwares"
|
||||
|
||||
$Packages = @(
|
||||
"chocolatey-core.extension",
|
||||
"chocolatey-compatibility.extension",
|
||||
"chocolatey-windowsupdate.extension",
|
||||
"vcredist140",
|
||||
|
||||
"7zip.install",
|
||||
"googlechrome",
|
||||
"firefoxesr",
|
||||
"microsoft-edge",
|
||||
"notepadplusplus.install",
|
||||
"vlc.install",
|
||||
#"foxitreader",
|
||||
#"libreoffice-fresh",
|
||||
"audacity",
|
||||
#"algobox",
|
||||
"python3",
|
||||
"xmind"
|
||||
|
||||
|
||||
)
|
||||
|
||||
#endregion
|
||||
|
||||
#region LOGGING
|
||||
|
||||
function Write-Log {
|
||||
|
||||
param ([string]$Message)
|
||||
|
||||
$Time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||
|
||||
$Entry = "$Time - $Message"
|
||||
|
||||
Write-Output $Entry
|
||||
|
||||
try {
|
||||
Add-Content $LogFile $Entry
|
||||
}
|
||||
catch {}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GLOBAL TIMER
|
||||
|
||||
$ScriptStartTime = Get-Date
|
||||
|
||||
function Test-GlobalTimeout {
|
||||
|
||||
$Elapsed = (Get-Date) - $ScriptStartTime
|
||||
|
||||
if ($Elapsed.TotalMinutes -gt $GlobalTimeoutMinutes) {
|
||||
|
||||
Write-Log "GLOBAL TIMEOUT atteint"
|
||||
|
||||
exit 1
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PREREQUIS
|
||||
|
||||
Write-Log "Verification prerequis"
|
||||
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||
|
||||
[System.Net.ServicePointManager]::SecurityProtocol =
|
||||
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||
|
||||
#endregion
|
||||
|
||||
#region INSTALL CHOCOLATEY
|
||||
|
||||
if (!(Get-Command choco -ErrorAction SilentlyContinue)) {
|
||||
|
||||
Write-Log "Installation Chocolatey"
|
||||
|
||||
Invoke-Expression (
|
||||
(New-Object System.Net.WebClient).DownloadString(
|
||||
"https://community.chocolatey.org/install.ps1"
|
||||
)
|
||||
)
|
||||
|
||||
refreshenv
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Log "Chocolatey deja installe"
|
||||
|
||||
}
|
||||
|
||||
choco feature enable -n allowGlobalConfirmation
|
||||
|
||||
#endregion
|
||||
|
||||
#region LOCAL REPO CHECK
|
||||
|
||||
if (!(Test-Path $LocalRepo)) {
|
||||
Write-Log "Creation depot local : $LocalRepo"
|
||||
New-Item -ItemType Directory -Path $LocalRepo -Force
|
||||
}
|
||||
|
||||
Write-Log "Depot local : $LocalRepo"
|
||||
|
||||
#endregion
|
||||
|
||||
#region DOWNLOAD MISSING PACKAGES
|
||||
|
||||
Write-Log "Telechargement packages manquants vers depot local"
|
||||
|
||||
foreach ($Package in $Packages) {
|
||||
Test-GlobalTimeout
|
||||
|
||||
$PackageFile = Get-ChildItem $LocalRepo -Filter "$Package*.nupkg" -ErrorAction SilentlyContinue
|
||||
|
||||
if (!$PackageFile) {
|
||||
Write-Log "Telechargement $Package"
|
||||
|
||||
$DownloadArgs = "download $Package --source chocolatey --output-directory `"$LocalRepo`" -y --no-progress"
|
||||
|
||||
$Process = Start-Process choco -ArgumentList $DownloadArgs -PassThru -WindowStyle Hidden
|
||||
|
||||
if ($Process.WaitForExit(300000)) { # 5 minutes timeout
|
||||
if ($Process.ExitCode -eq 0) {
|
||||
Write-Log "Telechargement succes $Package"
|
||||
} else {
|
||||
Write-Log "Erreur telechargement $Package code $($Process.ExitCode)"
|
||||
}
|
||||
} else {
|
||||
Write-Log "Timeout telechargement $Package"
|
||||
try { $Process.Kill() } catch {}
|
||||
}
|
||||
} else {
|
||||
Write-Log "Package $Package deja present localement"
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INSTALL FUNCTION WITH TIMEOUT + LOCAL SOURCE
|
||||
|
||||
function Install-PackageWithTimeout {
|
||||
|
||||
param (
|
||||
[string]$PackageName
|
||||
)
|
||||
|
||||
for ($i = 1; $i -le $RetryCount; $i++) {
|
||||
|
||||
Test-GlobalTimeout
|
||||
|
||||
Write-Log "Installation $PackageName tentative $i"
|
||||
|
||||
$Arguments = "install $PackageName -y --no-progress"
|
||||
|
||||
if (Test-Path $LocalRepo) {
|
||||
|
||||
$PackageFile = Get-ChildItem $LocalRepo -Filter "$PackageName*.nupkg" -ErrorAction SilentlyContinue
|
||||
|
||||
if ($PackageFile) {
|
||||
|
||||
Write-Log "Installation depuis depot local"
|
||||
|
||||
$Arguments += " --source `"$LocalRepo`""
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Log "Package absent localement - utilisation Internet"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$Process = Start-Process `
|
||||
choco `
|
||||
-ArgumentList $Arguments `
|
||||
-PassThru
|
||||
#-WindowStyle Hidden
|
||||
|
||||
if ($Process.WaitForExit($PackageTimeoutSeconds * 1000)) {
|
||||
|
||||
if ($Process.ExitCode -eq 0) {
|
||||
|
||||
Write-Log "Succes $PackageName"
|
||||
return
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Log "Erreur code $($Process.ExitCode)"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Log "Timeout $PackageName"
|
||||
|
||||
try {
|
||||
$Process.Kill()
|
||||
}
|
||||
catch {}
|
||||
|
||||
}
|
||||
|
||||
Start-Sleep 10
|
||||
|
||||
}
|
||||
|
||||
Write-Log "Echec final $PackageName"
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INSTALLATION PACKAGES
|
||||
|
||||
foreach ($Package in $Packages) {
|
||||
|
||||
Install-PackageWithTimeout $Package
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UPGRADE FINAL
|
||||
|
||||
Write-Log "Upgrade global"
|
||||
|
||||
choco upgrade all -y --no-progress
|
||||
|
||||
#endregion
|
||||
|
||||
Write-Log "Script termine"
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1 @@
|
||||
QH1dmYzydnEwawIldamuB1KVoTasIA+KShamPYe0+uE=
|
||||
@@ -0,0 +1,12 @@
|
||||
powercfg.exe /change disk-timeout-ac 0
|
||||
powercfg.exe /change disk-timeout-dc 0
|
||||
powercfg.exe /change standby-timeout-ac 0
|
||||
powercfg.exe /change standby-timeout-dc 0
|
||||
powercfg.exe /change hibernate-timeout-ac 0
|
||||
powercfg.exe /change hibernate-timeout-dc 0
|
||||
#powercfg.exe /change monitor-timeout-ac 0
|
||||
|
||||
$ParentRep = Split-Path -Path $PSScriptRoot -Parent
|
||||
|
||||
Copy-Item -Path "$ParentRep\Arrêter.lnk" -Destination $env:PUBLIC\Desktop
|
||||
Copy-Item -Path "$ParentRep\Se Déconnecter.lnk" -Destination $env:PUBLIC\Desktop
|
||||
@@ -0,0 +1 @@
|
||||
76492d1116743f0423413b16050a5345MgB8AHcAQwBaAFgAUABLAGEAbAByAFcAeQBaAC8AMwAyAHgAMABCAGgAZAB2AGcAPQA9AHwAMwBhAGUAZQBjAGUAZgAzADgAYgAxADIAYQAxAGMAMgBmAGMAYQAyADEAYwBkADMAYgA4AGUAZQBjAGEAMQA5ADEANQA1ADkANQAxAGYAOQAzADUANwA5ADkAZABiADYAOQBiADMAOABkADUAOQA5ADYAYwAyADAANwA3ADYAZQBkAGYANwBlADAAZAA2ADUANgAyAGUANAA3ADcAYQA4ADMANwBjAGEAMwA0AGMAZQA3ADMAZAAwADEAMwA2ADkA
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
|
||||
; Régles à effectuer sur des postes en 64 bits !
|
||||
|
||||
; Suppression du dossier Téléchargements
|
||||
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}]
|
||||
|
||||
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}]
|
||||
|
||||
; Suppression du dossier Musique
|
||||
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}]
|
||||
|
||||
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}]
|
||||
|
||||
; Suppression du dossier Images
|
||||
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}]
|
||||
|
||||
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}]
|
||||
|
||||
; Suppression du dossier Vidéos
|
||||
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}]
|
||||
|
||||
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}]
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search]
|
||||
"AllowCortana"=dword:00000000
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TapiSrv]
|
||||
"Start"=dword:00000004
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WbioSrvc]
|
||||
"Start"=dword:00000004
|
||||
@@ -0,0 +1,40 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
|
||||
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll]
|
||||
|
||||
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell]
|
||||
|
||||
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open]
|
||||
"MuiVerb"="@photoviewer.dll,-3043"
|
||||
|
||||
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command]
|
||||
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
|
||||
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
|
||||
6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\
|
||||
00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\
|
||||
25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,50,00,68,00,6f,\
|
||||
00,74,00,6f,00,20,00,56,00,69,00,65,00,77,00,65,00,72,00,5c,00,50,00,68,00,\
|
||||
6f,00,74,00,6f,00,56,00,69,00,65,00,77,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
|
||||
00,22,00,2c,00,20,00,49,00,6d,00,61,00,67,00,65,00,56,00,69,00,65,00,77,00,\
|
||||
5f,00,46,00,75,00,6c,00,6c,00,73,00,63,00,72,00,65,00,65,00,6e,00,20,00,25,\
|
||||
00,31,00,00,00
|
||||
|
||||
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget]
|
||||
"Clsid"="{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}"
|
||||
|
||||
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print]
|
||||
|
||||
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\command]
|
||||
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
|
||||
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
|
||||
6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\
|
||||
00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\
|
||||
25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,50,00,68,00,6f,\
|
||||
00,74,00,6f,00,20,00,56,00,69,00,65,00,77,00,65,00,72,00,5c,00,50,00,68,00,\
|
||||
6f,00,74,00,6f,00,56,00,69,00,65,00,77,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
|
||||
00,22,00,2c,00,20,00,49,00,6d,00,61,00,67,00,65,00,56,00,69,00,65,00,77,00,\
|
||||
5f,00,46,00,75,00,6c,00,6c,00,73,00,63,00,72,00,65,00,65,00,6e,00,20,00,25,\
|
||||
00,31,00,00,00
|
||||
|
||||
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\DropTarget]
|
||||
"Clsid"="{60fd46de-f830-4894-a628-6fa81bc0190d}"
|
||||
@@ -0,0 +1,25 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate]
|
||||
"ElevateNonAdmins"=dword:1
|
||||
"AcceptTrustedPublisherCerts"=dword:1
|
||||
"DisableWindowsUpdateAccess"=dword:1
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU]
|
||||
"NoAutoRebootWithLoggedOnUsers"=dword:1
|
||||
"RebootRelaunchTimeoutEnabled"=dword:0
|
||||
"RebootWarningTimeoutEnabled"=dword:1
|
||||
"RescheduleWaitTimeEnabled"=dword:0
|
||||
"AutoInstallMinorUpdates"=dword:1
|
||||
"DetectionFrequencyEnabled"=dword:1
|
||||
"DetectionFrequency"=dword:2
|
||||
"UseWUServer"=dword:1
|
||||
"AUPowerManagement"=dword:1
|
||||
"NoAUAsDefaultShutdownOption"=dword:1
|
||||
"NoAUShutdownOption"=dword:0
|
||||
"RebootRelaunchTimeout"=dword:1
|
||||
"ScheduledInstallDay"=dword:0
|
||||
"ScheduledInstallTime"=dword:c
|
||||
"RebootWarningTimeout"=dword:1
|
||||
"RescheduleWaitTime"=dword:1
|
||||
"AUOptions"=dword:4
|
||||
@@ -0,0 +1,43 @@
|
||||
REGEDIT4
|
||||
|
||||
# inscription au domaine
|
||||
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters]
|
||||
"DomainCompatibilityMode"=dword:00000001
|
||||
"DNSNameResolutionRequired"=dword:00000000
|
||||
# fix win7 "ressource non disponible" sur accès partage cf stratégie Client réseau Microsoft : communications signées numériquement (toujours)
|
||||
"RequireSecuritySignature"=dword:00000000
|
||||
|
||||
# evite erreur chargement de profils (CompatibleRUPSecurity)
|
||||
# WaitForNetwork equivalent gpedit.msc Stratégie ordinateur local / Configuration ordinateur / Modèles d’administration / Système / Profils des utilisateurs,
|
||||
# activer Définir le temps d’attente maximal pour le réseau si un utilisateur a un profil utilisateur ou un répertoire d’accueil distant itinérant et mettre 0 secondes
|
||||
# cf http://wiki.samba.org/index.php/Windows7
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System]
|
||||
"CompatibleRUPSecurity"=dword:1
|
||||
"SlowLinkDetectEnabled"=dword:00000000
|
||||
"WaitForNetwork"=dword:00000000
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
|
||||
"CompatibleRUPSecurity"=dword:1
|
||||
"RunLogonScriptSync"=dword:1
|
||||
|
||||
;http://support.microsoft.com/kb/2743127/fr
|
||||
;necessaire au bon fonctionnement de joindom
|
||||
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
|
||||
"LsaAllowReturningUnencryptedSecrets"=dword:1
|
||||
|
||||
|
||||
;--------------------------------------
|
||||
; Desactivation du service Webclient
|
||||
; voir http://support.microsoft.com/?scid=kb%3Bfr%3B832161&x=5&y=14
|
||||
;-------------------------------------
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient]
|
||||
"Start"=dword:00000004
|
||||
|
||||
|
||||
;--------------------------------------
|
||||
; correction accès refusé à netlogon
|
||||
;--------------------------------------
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\NetworkProvider\HardenedPaths]
|
||||
"\\\\*\\netlogon"="RequireMutualAuthentication=0,RequireIntegrity=0,RequirePrivacy=0"
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
|
||||
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer]
|
||||
"DisableNotificationCenter"=dword:00000001
|
||||
|
||||
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Explorer]
|
||||
"DisableNotificationCenter"=dword:00000001
|
||||
@@ -0,0 +1,4 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Personalization]
|
||||
"NoLockScreen"=dword:00000001
|
||||
Binary file not shown.
Reference in New Issue
Block a user