「このプリンターを信頼しますか?」のメッセージを非表示にする

新しい共用プリンタを使用する時、下記のような「このプリンターを信頼しますか?」のメッセージが出てくる
1、2件ならいいが10台近く割り当てなくてはならないとき、少々鬱陶しい。

_1_14021016274490-4C4

_1_14021016274550-6586
このメッセージを非表示にする方法が分かったので、メモしておきます。

このスクリプトを自動起動させておけば、確認メッセージを見ることはなくなる

On Error Resume Next
Dim WMI, OS, Value, Shell

do while WScript.Arguments.Count = 0 and WScript.Version >= 5.7
    Set WMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set OS = WMI.ExecQuery("SELECT *FROM Win32_OperatingSystem")
    For Each Value in OS
    if left(Value.Version, 3) < 6.0 then exit do
    Next
    Set Shell = CreateObject("Shell.Application")
    Shell.ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ uac", "", "runas"
    WScript.Quit
loop

Dim objWshShell,num
Set objWshShell = WScript.CreateObject("WScript.Shell")

num = objWshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint\Restricted")

if num = "" then 
  objWshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint\Restricted", 0, "REG_DWORD"
  objWshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint\TrustedServers", 0, "REG_DWORD"
  objWshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint\InForest", 0, "REG_DWORD"
  objWshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows NT\Printers\PointAndPrint\Restricted", 0, "REG_DWORD"
  objWshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows NT\Printers\PointAndPrint\TrustedServers", 0, "REG_DWORD"
  objWshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows NT\Printers\PointAndPrint\InForest", 0, "REG_DWORD"
end if

Set objWshShell = nothing

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です