IT - Fixing black screen background

IT - Fixing black screen background

Many IT departments in various organizations are facing a daily issues, some are frequently repeatable and many are very rare to occur. hint; don't treat computers as a "smart", this is marketing people always love to use this word.

So, i received a call from my friend in IT department (like me) working with different organization, and complain that they are receiving a daily request tickets to fix a Black background screen.

example from internet

[Example image] After asking certain questions, i came to a conclusion that their IT department has a poor communication. And i need to not to show him how to fix this issue manual, instead i wrote a Powershell script to mitigate the Technicians' time waste which indirectly saving extra cost and headache.

I have this great mental, that if you find a small issue try to fix the root cause and think of fixing it on a massive scale (thousands of computers).

No alt text provided for this image

Here you go:

$UserThemesPath = Get-WmiObject win32_userprofile | where { -not $_.special } | select -expand localpath  |  foreach {"$_\AppData\Roaming\Microsoft\Windows\Themes"}

 foreach ($LocalPath in $UserThemesPath) {


  If (Test-Path $LocalPath -ErrorAction SilentlyContinue ) {
   
                $destination = Join-Path $LocalPath 'CachedFiles'
                $fileToCheckD = (Get-ChildItem $destination -Recurse -Include "*.*" -ErrorAction SilentlyContinue)
                 
 foreach ($SoloImg in $fileToCheckD) {

$bas64Image = "/9j/4AAQSkZJRgABAQEBLAEsAAD/4QNqRXhpZgAATU0AKgAAAAgACAEPAAIAAAAFAAAAbgEQAAIAAAAHAAAAdAEaAAUAAAABAAAAfAEbAAUAAAABAAAAhAEoAAMAAAABAAIAAAExAAIAAAApAAAAjAEyAAIAAAAUAAAAtodpAAQAAAABAAAAygAAAABTT05ZAABJTENFLTkAAAAAASwAAAABAAABLAAAAAFQaG90b1NoZWx0ZXIgaHR0cDovL3d3dy5waG90b3NoZWx0ZXIuY29tAAAyMDE5OjExOjI3IDE5OjUwOjMwAAAlgpoABQAAAAEAAAKMgp0ABQAAAAEAAAKUiCIAAwAAAAEAAQAAiCcAAwAAAAEfQAAAiDAAAwAAAAEAAgAAiDIABAAAAAEAAB9AkAAABwAAAAQwMjMxkAMAAgAAABQAAAKckAQAAgAAABQAAAKwkBAAAgAAAAcAAALEkBEAAgAAAAcAAALMkBIAAgAAAAcAAALUkgEACgAAAAEAAALckgIABQAAAAEAAALkkgMACgAAAAEAAALskgQACgAAAAEAAAL0kgUABQAAAAEAAAL8kgcAAwAAAAEABQAAkggAAwAAAAEAAAAAkgkAAwAAAAEAEAAAkgoABQAAAAEAAAMEog4ABQAAAAEAAAMMog8ABQAAAAEAAAMUohAAAwAAAAEAAwAAowAABwAAAAEDAAAAowEABwAAAAEBAAAApAEAAwAAAAEAAAAApAIAAwAAAAEAAQAApAMAAwAAAAEAAAAApAQABQAAAAEAAAMcpAUAAwAAAAEAtwAApAYAAwAAAAEAAAAApAgAAwAAAAEAAAAApAkAAwAAAAEAAAAApAoAAwAAAAEAAAAApDIABQAAAAQAAAMkpDQAAgAAAB0AAANEAAAAAAAAAAEAAAD6AAAAOAAAAAoyMDE5OjExOjI3IDE5OjIwOjU3ADIwMTk6MTE6MjcgMTk6MjA6NTcAKzA0OjAwAAArMDU6MDAAACswNTowMAAAAHmMWAAPQkAAS9lmAA9CQAAAE3gAAAoAAAAAAAAAAAoAAAT4AAABAAAAByYAAAAKA0n33AAAgAADSffcAACAAAAAABAAAAAQAAAD6AAAAAoAAA ....# Missing code due to larg data (download the file from below URLs)


If ($bas64Image)
{
    #$tmpImage = "$env:TEMP\tmpImage.png"
    [byte[]]$Bytes = [convert]::FromBase64String($bas64Image)
    [System.IO.File]::WriteAllBytes($SoloImg,$Bytes)
    
    # Parmenent user Wallpaper
    $PrmntWallpaper = "$LocalPath\BG_Image.jpg"
    [System.IO.File]::WriteAllBytes($PrmntWallpaper,$Bytes)
    
    write-host $SoloImg
    Write-Host $PrmntWallpaper
}
    $RegKey = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\System"
    New-ItemProperty -Path $RegKey -name Wallpaper -value "$LocalPath\BG_Image.jpg" -PropertyType String -Force


}
}
}

You may download the script from one of below URLs and follow the instructions.

What you need for a successful implementation? follow my instructions:

  • Run the script with Admin privileges.
  • Better to implement the script via Endpoint Management such; SCCM or else.
  • Make sure to sign the script; either organization certificate or unrestricted the powershell policy.

Let me know what do you think, and how did you avoid the issue to effect your end-users.


Best Regards,

No alt text provided for this image


Mohamed Hafiz

IT Asset Management and Service Management Professional.

4 年

????

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了