Windows Client

Windows 10 Pro Sürümü için GPO ile Lock Screen Yönetimi- Configure Windows Spotlight on the lock screen

Windows Spotlight, farklı arka plan görüntülerini görüntüleyen ve bazen kilit ekranında öneriler sunan kilit ekranı arka planı için bir seçenek olarak Windows 10 da sunulan bir özelliktir. Bu özellik tüm Windows 10 masa üstü sürümlerinde yer almaktadır.

Bazı şirketlerin iş ihtiyacı nedeni ile lock screen olarak ifade ettiğimiz işletim sistemi ekranının kilitlendiğinde ortaya çıkan bu görselleri kurumsal görseller ile değiştirmek isteyebilir. Bu durumda aşağıdaki makale ile kolaylıkla yapılabilir;

https://learn.microsoft.com/en-us/windows/configuration/windows-spotlight

Fakat bu yöntem Windows 10 Enterprise ve Windows 10 Education sürümleri için çalışan bir yöntemdir.

Aşağıdaki yolu takip edebilirsiniz;

“Computer Configuration\Administrative Templates\Control Panel\Personalization\Force a specific default lock screen and logon image”

Gördüğünüz gibi Pro sürümü için bu basit yöntem işe yaramıyor.

Hatta aynı makalede 3 parti uygulama önerilmektedir.

For managed devices running Windows 10 Enterprise and Windows 10 Education, enterprise administrators can configure a mobile device management (MDM) or Group Policy setting to prevent users from using the Windows Spotlight background. For managed devices running Windows 10 Pro, version 1607, administrators can disable suggestions for third party apps.

Not: Aşağıdaki iki ayardan birisi açık ise lock screen da resim görüntüleyemezsiniz.

Birinci ayar;

This PC> Properties> Advanced system settings> Performance settings> Visual Effects bölümünde bulunnan “Animate windows when minimizing and maximizing” kutucuğu işaretli olmayacak

Veya ikinci ayar ise aşağıdaki GPO ayarıdır;

Computer Configuration> Administrative Templates> Windows Components> Desktop Windows Manager> Do not allow windows animations.

Peki bu iki ayarın olmadığını düşünüyoruz ve kullandığımız Windows 10 sürümü Pro ise bu işi GPO ile nasıl yapacağız?

Öncelikle aşağıdaki komutu bir not defterine alıp ismini Set-Screen.ps1 olarak güncelliyoruz.

# Change this to the path where you keep the desired background image
$imagePath = '(Path to Image, include single quotes)'

$newImagePath = [System.IO.Path]::GetDirectoryName($imagePath) + '\' + (New-Guid).Guid + [System.IO.Path]::GetExtension($imagePath)
Copy-Item $imagePath $newImagePath
[Windows.System.UserProfile.LockScreen,Windows.System.UserProfile,ContentType=WindowsRuntime] | Out-Null
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType) {
    $asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
    $netTask = $asTask.Invoke($null, @($WinRtTask))
    $netTask.Wait(-1) | Out-Null
    $netTask.Result
}
Function AwaitAction($WinRtAction) {
    $asTask = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and !$_.IsGenericMethod })[0]
    $netTask = $asTask.Invoke($null, @($WinRtAction))
    $netTask.Wait(-1) | Out-Null
}
[Windows.Storage.StorageFile,Windows.Storage,ContentType=WindowsRuntime] | Out-Null
$image = Await ([Windows.Storage.StorageFile]::GetFileFromPathAsync($newImagePath)) ([Windows.Storage.StorageFile])
AwaitAction ([Windows.System.UserProfile.LockScreen]::SetImageFileAsync($image))
Remove-Item $newImagePath

Kullanımı son derece kolay, aşağıdaki gibi bir logon script tanımlamamız yeterli;

.\Set-Screen.ps1 -LockScreenSource “\\SERVER-FS01\LockScreen.jpg” -BackgroundSource “\\SERVER-FS01\BackgroundScreen.jpg” -LogPath “\\SERVER-FS01\Logs”

Eğer log dosyasına ihtiyacınız yok ise aşağıdaki komutu kullanabilirsiniz;

.\Set-Screen.ps1 -LockScreenSource “\\SERVER-FS01\LockScreen.jpg” -BackgroundSource \\SERVER-FS01\BackgroundScreen.jpg

Sadece lock screen için

.\Set-Screen.ps1 -LockScreenSource “\\SERVER-FS01\LockScreen.jpg” -LogPath \\SERVER-FS01\Logs

Sadece masa üstü resmi için

.\Set-Screen.ps1 -BackgroundSource “\\SERVER-FS01\BackgroundScreen.jpg” -LogPath “\\SERVER-FS01\Logs”

Peki gelelim bunu GPO ile nasıl dağıtacağız?

Öncelikle yeni veya mevcut bir GPO için Startup Script oluşturmamız gerekli;

Makine GPO üzerinden aşağıdaki alana kadar gelin;

Buraya bir ps göstereceğiz, yukarıdaki komut setlerinden istediğinizi bir not defterine alıp sonunu ps1. Olarak kayıt edebilirsiniz;

“\\SERVER-FS01\ortak\gpo\.\Set-Screen.ps1” -LockScreenSource “\\SERVER-FS01\LockScreen.jpg” -BackgroundSource “\\SERVER-FS01\BackgroundScreen.jpg” -LogPath “\\SERVER-FS01\Logs”

Not: indirdiğiniz ps dosyasını her makinenin erişebileceği bir yere kayıt ettikten sonra yukarıdaki gibi bu parth’ i göstermeniz gerekli.

Daha sonra bunu GPO ya tanımlıyoruz

Burada aklınıza Set-ExecutionPolicy için bir parametre gerekli mi sorusu gelebilir. Makine GPO olduğu için buna gerek yoktur.

Bundan sonra tek şey oluşturduğunuz bu GPO’ yu bir makine OU suna bağlamak kalıyor.

Umarım faydalı bir yazı olmuştur, bir sonraki yazımda görüşmek üzere.

Hakan Uzuner

2002 yılından beri aktif olarak bilişim sektöründe çalışmaktayım. Bu süreç içerisinde özellikle profesyonel olarak Microsoft teknolojileri üzerinde çalıştım. Profesyonel kariyerim içerisinde eğitmenlik, danışmanlık ve yöneticilik yaptım. Özellikle danışmanlık ve eğitmenlik tecrübelerimden kaynaklı pek çok farklı firmanın alt yapısının kurulum, yönetimi ve bakımında bulundum. Aynı zamanda ÇözümPark Bilişim Portalı nın Kurucusu olarak portal üzerinde aktif olarak rol almaktayım. Profesyonel kariyerime ITSTACK Bilgi Sistemlerinde Profesyonel Hizmetler Direktörü olarak devam etmekteyim.

İlgili Makaleler

3 Yorum

  1. Hakan Bey Merhabalar,
    Öncelikle ben bu işlemlerde yeniyim, o yüzden dediklerinizi doğru uygulamış olamayabilirim. Şimdi ben fileserverdan bir ekran görüntüsü alıp, onu kilit ekranlarına göndermek istiyorum. Birincisi ilk indirdiğimiz script de bir değişiklik yapacak mıyız? Ben orada değişiklik yaparak da yapmadan da denediğimde olmadı. Nerede yanlış yapıyor olabilirim? Vakit bulduğunuz da yardımcı olabilir misiniz? Şimdiden teşekkürler.

  2. Hakan bey selam,

    İndirdiğimiz Powershell dosyasında değişiklikleri yaptım fakat çalıştıramadım. Çıktı nasıl olmalıdır ? Yada düzenlenmiş olan bir shell dosyası paylaşabilir misiniz ?

    Set Lock Screen only:
    Set-Screen -LockScreenSource \\10.0.0.100\bilgiislem\slayt\vankedisi.jpg -LogPath \\10.0.0.100\bilgiislem\slayt\Log
    Param(
    [Parameter(Mandatory=$false,Position=0)]
    [ValidateNotNullOrEmpty()]
    [string]$LockScreenSource,
    [Parameter(Mandatory=$false,Position=1)]
    [ValidateNotNullOrEmpty()]
    [string]$BackgroundSource,
    [Parameter(Mandatory=$false,Position=2)]
    [ValidateNotNullOrEmpty()]
    [string]$LogPath
    )

    #Requires -RunAsAdministrator

    if (-not [string]::IsNullOrWhiteSpace($LogPath)) {
    Start-Transcript -Path “$($LogPath)\$($env:COMPUTERNAME).log” | Out-Null
    }

    $ErrorActionPreference = “Stop”

    $RegKeyPath = “HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP”

    $DesktopPath = “DesktopImagePath”
    $DesktopStatus = “DesktopImageStatus”
    $DesktopUrl = “DesktopImageUrl”
    $LockScreenPath = “LockScreenImagePath”
    $LockScreenStatus = “LockScreenImageStatus”
    $LockScreenUrl = “LockScreenImageUrl”

    $StatusValue = “1”
    $DesktopImageValue = “C:\Windows\System32\Desktop.jpg”
    $LockScreenImageValue = “C:\Windows\System32\LockScreen.jpg”

    if (!$LockScreenSource -and !$BackgroundSource)
    {
    Write-Host “Either LockScreenSource or BackgroundSource must has a value.”
    }
    else
    {
    if(!(Test-Path $RegKeyPath)) {
    Write-Host “Creating registry path $($RegKeyPath).”
    New-Item -Path $RegKeyPath -Force | Out-Null
    }
    if ($LockScreenSource) {
    Write-Host “Copy Lock Screen image from $($LockScreenSource) to $($LockScreenImageValue).”
    Copy-Item $LockScreenSource $LockScreenImageValue -Force
    Write-Host “Creating registry entries for Lock Screen”
    New-ItemProperty -Path $RegKeyPath -Name $LockScreenStatus -Value $StatusValue -PropertyType DWORD -Force | Out-Null
    New-ItemProperty -Path $RegKeyPath -Name $LockScreenPath -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
    New-ItemProperty -Path $RegKeyPath -Name $LockScreenUrl -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
    }
    if ($BackgroundSource) {
    Write-Host “Copy Desktop Background image from $($BackgroundSource) to $($DesktopImageValue).”
    Copy-Item $BackgroundSource $DesktopImageValue -Force
    Write-Host “Creating registry entries for Desktop Background”
    New-ItemProperty -Path $RegKeyPath -Name $DesktopStatus -Value $StatusValue -PropertyType DWORD -Force | Out-Null
    New-ItemProperty -Path $RegKeyPath -Name $DesktopPath -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null
    New-ItemProperty -Path $RegKeyPath -Name $DesktopUrl -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null
    }
    }

    if (-not [string]::IsNullOrWhiteSpace($LogPath)){Stop-Transcript}

  3. arkadaşlar bu makale temel PS bilgisi gerektirir, yani sıfırdan yapmanız zor olabilir, bunun için soruları foruma sorabilirsiniz, burayı takip etmiyorum çünkü.

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Başa dön tuşu