Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jamiechalmerzlp/da4bf8307cf511ce75f35a2bb63b79fe to your computer and use it in GitHub Desktop.
Save jamiechalmerzlp/da4bf8307cf511ce75f35a2bb63b79fe to your computer and use it in GitHub Desktop.
## DEFINE THE DIRECTORY PATH
$directoryPath = "C:\temp"
## CHECK IF THE DIRECTORY EXISTS
if (-Not (Test-Path -Path $directoryPath)) {
## IF THE DIRECTORY DOES NOT EXIST, CREATE IT
New-Item -Path $directoryPath -ItemType Directory
Write-Output "Directory $directoryPath created."
} else {
Write-Output "Directory $directoryPath already exists."
}
$transcriptPath = "$directoryPath\transcript.log"
Start-Transcript -Path $transcriptPath -Append
Write-Output "Transcript started. Logging to $transcriptPath."
## DISABLE FAST BOOT
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name "HiberbootEnabled" -Value 0
Write-Host "Fast Boot has been disabled. Please restart your computer for the changes to take effect."
## DISABLE POWER MANAGEMENT ON ALL NIC
Get-NetAdapter | ForEach-Object {
Disable-NetAdapterPowerManagement -Name $_.Name
Write-Host "Power management disabled for network adapter: $($_.Name)"
}
## SPECIFY THE DIRECTORY PATH
$directoryPath = "C:\MDM\"
## CHECK IF THE DIRECTORY EXISTS
if (-not (Test-Path -Path $directoryPath)) {
## DIRECTORY DOES NOT EXIST, SO CREATE IT
New-Item -Path $directoryPath -ItemType Directory
Write-Host "Directory created at: $directoryPath"
} else {
## DIRECTORY ALREADY EXISTS
Write-Host "Directory already exists at: $directoryPath"
}
## SET THE WALLPAPER
$imageUrl = "WALLPAPERURL.JPG" ## UPDATE THIS TO YOUR URL FOR THE WALLPAPER
$savePath = "C:\MDM\WALLPAPER.jpg" ## UPDATE THIS FILE NAME TO THE NAME OF YOUR WALLPAPER LISTED IN THE IMAGEURL
Invoke-WebRequest -Uri $imageUrl -OutFile $savePath
if (Test-Path $savePath) {
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "Wallpaper" -Value $savePath
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
Write-Host "Wallpaper has been set to $savePath"
} else {
Write-Host "Failed to download the image."
}
# Stop the transcript when the script is done
Stop-Transcript
Write-Output "Transcript stopped."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment