Usuário com melhor resposta
Alterar o registro do windows via vbs

Pergunta
-
Queridos colegas preciso criar um script que bloqueie as propriedades de video e altere o papel de parede por um especifico na rede que é o padrão. O arquivo tem que ser chamado por um BAT que mapeia as unidades de rede. Alguém tem alguma luz ?????
LUIZ AUGUSTO - ANALISTA SUPORTE
Respostas
-
Segue script para bloquear Display Settings
Ref. http://www.dougknox.com/security/scripts_desc/displayapplet.htm'displayapplet.vbs '© Doug Knox - rev 12/10/99 Option Explicit 'Declare variables Dim WSHShell, n, MyBox, p, p1, p2, t, mustboot, errnum, vers Dim enab, disab, jobfunc, itemtype Set WSHShell = WScript.CreateObject("WScript.Shell") p = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\" p = p & "NoDispCPL" itemtype = "REG_DWORD" mustboot = "" enab = "ENABLED" disab = "DISABLED" jobfunc = "Display Properties are now " 'This section tries to read the registry key value. If not present an 'error is generated. Normal error return should be 0 if value is 'present t = "Confirmation" Err.Clear On Error Resume Next n = WSHShell.RegRead (p) On Error Goto 0 errnum = Err.Number if errnum <> 0 then 'Create the registry key value for NoFolderOptions with value 0 WSHShell.RegWrite p, 0, itemtype End If 'If the key is present, or was created, it is toggled 'Confirmations can be disabled by commenting out 'the two MyBox lines below If n = 0 Then n = 1 WSHShell.RegWrite p, n, itemtype Mybox = MsgBox(jobfunc & disab & vbCR & mustboot, 4096, t) ElseIf n = 1 then n = 0 WSHShell.RegWrite p, n, itemtype Mybox = MsgBox(jobfunc & enab & vbCR & mustboot, 4096, t) End If
Abraços
Edson Matias Fagundes Junior - (Nioks)
MCP, MCTS: 2008, MCTS:MBS
Se a resposta for valida por favor vote como útil.- Sugerido como Resposta Edson Matias Fagundes Junior segunda-feira, 22 de agosto de 2011 12:04
- Marcado como Resposta Richard Juhasz quinta-feira, 1 de setembro de 2011 20:15
Todas as Respostas
-
Luiz indico você fazer da seguinte forma
No ad apenas deixei bloqueada a alteração de papel de parede e configurações de video, e defini o papel de parede utilizando a ferramenta BGinfo.
Abraços
Edson Matias Fagundes Junior - (Nioks)
MCP, MCTS: 2008, MCTS:MBS
Se a resposta for valida por favor vote como útil. -
Segue script para bloquear Display Settings
Ref. http://www.dougknox.com/security/scripts_desc/displayapplet.htm'displayapplet.vbs '© Doug Knox - rev 12/10/99 Option Explicit 'Declare variables Dim WSHShell, n, MyBox, p, p1, p2, t, mustboot, errnum, vers Dim enab, disab, jobfunc, itemtype Set WSHShell = WScript.CreateObject("WScript.Shell") p = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\" p = p & "NoDispCPL" itemtype = "REG_DWORD" mustboot = "" enab = "ENABLED" disab = "DISABLED" jobfunc = "Display Properties are now " 'This section tries to read the registry key value. If not present an 'error is generated. Normal error return should be 0 if value is 'present t = "Confirmation" Err.Clear On Error Resume Next n = WSHShell.RegRead (p) On Error Goto 0 errnum = Err.Number if errnum <> 0 then 'Create the registry key value for NoFolderOptions with value 0 WSHShell.RegWrite p, 0, itemtype End If 'If the key is present, or was created, it is toggled 'Confirmations can be disabled by commenting out 'the two MyBox lines below If n = 0 Then n = 1 WSHShell.RegWrite p, n, itemtype Mybox = MsgBox(jobfunc & disab & vbCR & mustboot, 4096, t) ElseIf n = 1 then n = 0 WSHShell.RegWrite p, n, itemtype Mybox = MsgBox(jobfunc & enab & vbCR & mustboot, 4096, t) End If
Abraços
Edson Matias Fagundes Junior - (Nioks)
MCP, MCTS: 2008, MCTS:MBS
Se a resposta for valida por favor vote como útil.- Sugerido como Resposta Edson Matias Fagundes Junior segunda-feira, 22 de agosto de 2011 12:04
- Marcado como Resposta Richard Juhasz quinta-feira, 1 de setembro de 2011 20:15
-
E esse é para colocar o papel de parede.
Ref. http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_21470879.htmldim wshShell dim sUserName Set wshShell = WScript.CreateObject("WScript.Shell") sUserName = wshShell.ExpandEnvironmentStrings("%USERNAME%") Set oShell = CreateObject("WScript.Shell") Set oFSO = CreateObject("Scripting.FileSystemObject") sWinDir = oFSO.GetSpecialFolder(0) sWallPaper = "D:\My Documents\DownLoad\" & sUserName & " - bkg.jpg" ' update in registry oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper ' let the system know about the change oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
Abraços
Edson Matias Fagundes Junior - (Nioks)
MCP, MCTS: 2008, MCTS:MBS
Se a resposta for valida por favor vote como útil.- Sugerido como Resposta Edson Matias Fagundes Junior segunda-feira, 22 de agosto de 2011 12:04
-