This is an old revision of the document!
$dossier = “%userprofile%\paf\le\chien”if (Test-Path -Path $dossier) { “Le dossier $dossier !”} else { “Création du dossier $dossier” mkdir $dossier }
$url = http://url_du_fichierInvoke-WebRequest -Uri $url -OutFile C:\Ou\va\le\fichier\fichier.prout
$WshShell = New-Object -ComObject WScript.Shell $Shortcut = $WshShell.CreateShortcut(“$env:PUBLIC\Desktop\Machin.lnk”) $Shortcut.TargetPath = “C:\ou\est\le\fichier\Machin.exe”$Shortcut.Save()
# On met les comptes dans un tableau $comptes = @(“utilisateur”,“toto”,“Administrateur”) ForEach ($compte in $comptes) { $op = Get-LocalUser | Where-Object {$_.Name -eq $compte} if ( -not $op) { “Création du compte $compte…” $password = Read-Host “Saisir le mot de passe du compte $compte (rien si pas de mot de passe)” -AsSecureString New-LocalUser -Name $compte -Password $password -AccountNeverExpires -UserMayNotChangePassword Add-LocalGroupMember -Group “Administrateurs” -Member $compte } else { “Le compte $compte existe déjà” if ((Get-LocalUser $compte).Enabled) { “Le compte $compte est déjà activé” } else { “Activation du compte $compte…” Enable-LocalUser -Name $compte “Le compte $compte est activé” } } } Set-LocalUser -Name 'Toto' -FullName “Jean-Michel Toto”
# Désactiver UAC New-ItemProperty -Path HKLM:Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -PropertyType DWord -Value 0 -Force # Désactiver pare-feu sur tous les profils Set-NetFirewallProfile -Profile * -Enabled False # Désactivation smart-screen Set-ItemProperty -Path “HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer” -Name “SmartScreenEnabled” -Type String -Value “Off”Set-ItemProperty -Path “HKCU:\Software\Microsoft\Windows\CurrentVersion\AppHost” -Name “EnableWebContentEvaluation” -Type DWord -Value # Désactivation OOBE Set-ItemProperty -Path “HKLM:\Software\Microsoft\Windows\CurrentVersion\OOBE” -Name “DisablePrivacyExperience” -Type DWORD -Value 1 -Force Set-ItemProperty -Path “HKLM:\Software\Microsoft\Windows\CurrentVersion\OOBE” -Name “PrivacyConstentStatus” -Type DWORD -Value 1 -Force Set-ItemProperty -Path “HKLM:\Software\Microsoft\Windows\CurrentVersion\OOBE” -Name “SkipMachineOOBE” -Type DWORD -Value 1 -Force # Activation client SMBv1 Enable-WindowsOptionalFeature -Online -FeatureName “SMB1Protocol-Client” -All # Installation de .NET3.5 Enable-WindowsOptionalFeature -Online -FeatureName “NetFx3”