windows – 在域上登录用户图片
发布时间:2020-12-13 19:19:48 所属栏目:Windows 来源:网络整理
导读:如何在整个域中为 Windows Vista,7,2008,2008R2计算机登录期间显示的每个单独用户更改“用户图片”? 对于你提到的操作系统,shell32.dll中有一个未发布的函数就是故障单.使用它将不受Microsoft支持,但我在几个环境中没有任何问题.入口点是#262. 您可以将其导
如何在整个域中为
Windows Vista,7,2008,2008R2计算机登录期间显示的每个单独用户更改“用户图片”?
对于你提到的操作系统,shell32.dll中有一个未发布的函数就是故障单.使用它将不受Microsoft支持,但我在几个环境中没有任何问题.入口点是#262.
您可以将其导入以在PowerShell中使用,如下所示: # Set user tile $code = @" [DllImport("shell32.dll",EntryPoint = "#262",CharSet = CharSet.Unicode,PreserveSig = false)] public static extern void SetUserTile(string username,int whatever,string picpath); public static void ChangeUserPicture(string username,string picpath) { SetUserTile(username,picpath); } "@ Add-Type -MemberDefinition $code -NameSpace Shell32 -Name ChangeUserTile 这意味着你可以在同一个脚本中调用它,就像: [Shell32.ChangeUserTile]::ChangeUserPicture(<username>,<pathtoimage>) 我已经使用以下作为登录脚本,也可以从AD中获取图像: # Set User Photo Script # Reads user's photo from AD and sets as users local display picture # Find User $search = [System.DirectoryServices.DirectorySearcher][System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().GetDirectoryEntry() $search.Filter = "(sAMAccountName=$env:username)" $user = $search.FindOne().GetDirectoryEntry() # Save image to %appdata% $user.thumbnailphoto | Set-Content $env:appdatausertilecache.jpg -Encoding byte # Set user tile $code = @" [DllImport("shell32.dll",picpath); } "@ Add-Type -MemberDefinition $code -NameSpace Shell32 -Name ChangeUserTile [Shell32.ChangeUserTile]::ChangeUserPicture(($env:userdomain + "" + $env:username),($env:appdata + "usertilecache.jpg")) # Tidy up Remove-Item ($env:appdata + "usertilecache.jpg") 我应该指出,我已经切换到使用编译的.NET应用程序,它做同样的事情,但具有更好的性能 – 在登录时非常关键. 它还让我可以选择在启动时调用并为尚未登录到机器的用户设置图像,这对于新用户来说是一个很好的补充,他们必须在指定的PC上看到他们的脸,而不是默认橙花! 值得指出的是,对于Windows 8起,我们必须完全重新设计 – 现在有一种来自MS的全新机制. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows – PE和ELF二进制代码差异
- windows-update – wusa.exe返回代码5是什么意思?
- 学习如何管理面向公众的Windows Server(2008)的书?
- ms-access – Microsoft Access 2007表单中的标签/ Texbox分
- Microsoft CA证书模板比预期更早到期
- windows-vista – 如何在Windows Vista Home Edition上授予
- windows – 如何获取Microsoft MSDN订阅者下载的静态下载链
- 如何从Windows批处理文件运行Java但隐藏命令窗口?
- .net – 故障模块:kernelbase.dll.应用程序崩溃
- windows在c中读取快捷方式文件的目标
推荐文章
站长推荐
- windows-server-2008-r2 – 为什么Windows Updat
- active-directory – GPO无法应用;原因:无法访问
- 从Windows CLI刷新磁盘写缓存
- active-directory – 由于LDAP绑定问题导致GPUpd
- windows – 为什么COM CoInitializeSecurity在我
- windows-7 – 如何检索Windows 7的安装ID和确认I
- windows – 如何重命名脱机文件夹引用的服务器?
- windows – 如何找出启动网络连接的进程/服务
- windows – 如何检测COM对象实现的所有接口?
- windows-phone-7 – 强制Windows Phone使用WIFI连
热点阅读