none
Alterar o registro do windows via vbs RRS feed

  • 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
    quinta-feira, 18 de agosto de 2011 20:33

Respostas

  • Segue script para bloquear Display Settings

    '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
    
    
    Ref. http://www.dougknox.com/security/scripts_desc/displayapplet.htm

    Abraços


    Edson Matias Fagundes Junior - (Nioks)
    MCP, MCTS: 2008, MCTS:MBS
    Se a resposta for valida por favor vote como útil.
    sexta-feira, 19 de agosto de 2011 12:17

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.
    quinta-feira, 18 de agosto de 2011 22:01
  • Segue script para bloquear Display Settings

    '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
    
    
    Ref. http://www.dougknox.com/security/scripts_desc/displayapplet.htm

    Abraços


    Edson Matias Fagundes Junior - (Nioks)
    MCP, MCTS: 2008, MCTS:MBS
    Se a resposta for valida por favor vote como útil.
    sexta-feira, 19 de agosto de 2011 12:17
  • E esse é para colocar o papel de parede.

    dim 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
    
    
    Ref. http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_21470879.html
    Abraços


    Edson Matias Fagundes Junior - (Nioks)
    MCP, MCTS: 2008, MCTS:MBS
    Se a resposta for valida por favor vote como útil.
    sexta-feira, 19 de agosto de 2011 12:20
  • Ola Luiz alguma novidade?

     

    Abraços


    Edson Matias Fagundes Junior - (Nioks)
    MCP, MCTS: 2008, MCTS:MBS
    Se a resposta for valida por favor vote como útil.
    segunda-feira, 22 de agosto de 2011 12:03