【问题标题】:Change lock screen Windows 10 powershell更改锁定屏幕 Windows 10 powershell
【发布时间】:2018-11-07 18:43:06
【问题描述】:

我正在创建一个脚本,当用户运行更新时,工作站会锁定屏幕。锁定屏幕是自定义 JPEG。更新时,用户无法登录。更新完成后,用户可以重新登录到他们的帐户。

我目前正在使用这种方法来更改锁屏: https://github.com/Sauler/PowershellUtils/blob/master/Set-LockscreenWallpaper/Set-LockscreenWallpaper.ps1

我现在正在寻找一种获取当前锁屏图像的方法,因为更新后我想替换用户的锁屏。

谁有这个方法?

【问题讨论】:

  • 为什么不在更换用户锁屏之前调用LockScreen.GetImageStream,将结果保存到一个临时位置,然后再恢复它?

标签: windows powershell scripting


【解决方案1】:

在Christian.K的推荐下我创建了一个函数

function Get-LockscreenWallpaperPath () {
$null = [Windows.System.UserProfile.LockScreen,Windows.System.UserProfile,ContentType=WindowsRuntime]
$Path = [Windows.System.UserProfile.LockScreen]::OriginalImageFile.AbsolutePath
$Path = $Path -replace '/','\'
return $Path

}

【讨论】:

    猜你喜欢
    • 2018-11-18
    • 1970-01-01
    • 1970-01-01
    • 2016-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多