Announcement

Collapse
No announcement yet.

VBS Logon script not working through group policy (Server 2012)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VBS Logon script not working through group policy (Server 2012)

    I have one VB script and trying to run through user logon script. Its not working, but its working if i run directly from the machine. Tried by disabling the UAC, its not working.
    Any suggestions please..
    Script attached for your reference.
    dim bExists
    dim cExists
    dim dExists
    dim eExists
    ssig="Unable to open registry key"

    set wshShell= Wscript.CreateObject("WScript.Shell")
    strKey = "HKCU\Software\Microsoft\Office\12.0\Outlook\Optio ns\Mail"
    on error resume next
    present = WshShell.RegRead(strKey)
    if err.number<>0 then
    if right(strKey,1)="" then 'strKey is a registry key
    if instr(1,err.description,ssig,1)<>0 then
    bExists=true
    else
    bExists=false
    end if
    else 'strKey is a registry valuename
    bExists=false
    end if
    err.clear
    else
    bExists=true
    end if
    on error goto 0

    strKey = "HKCU\Software\Microsoft\Office\14.0\Outlook\Optio ns\Mail"
    on error resume next
    present = WshShell.RegRead(strKey)
    if err.number<>0 then
    if right(strKey,1)="" then 'strKey is a registry key
    if instr(1,err.description,ssig,1)<>0 then
    cExists=true
    else
    cExists=false
    end if
    else 'strKey is a registry valuename
    cExists=false
    end if
    err.clear
    else
    cExists=true
    end if
    on error goto 0

    strKey = "HKCU\Software\Microsoft\Office\15.0\Outlook\Optio ns\Mail"
    on error resume next
    present = WshShell.RegRead(strKey)
    if err.number<>0 then
    if right(strKey,1)="" then 'strKey is a registry key
    if instr(1,err.description,ssig,1)<>0 then
    dExists=true
    else
    dExists=false
    end if
    else 'strKey is a registry valuename
    dExists=false
    end if
    err.clear
    else
    dExists=true
    end if
    on error goto 0

    strKey = "HKCU\Software\Microsoft\Office\16.0\Outlook\Optio ns\Mail"
    on error resume next
    present = WshShell.RegRead(strKey)
    if err.number<>0 then
    if right(strKey,1)="" then 'strKey is a registry key
    if instr(1,err.description,ssig,1)<>0 then
    eExists=true
    else
    eExists=false
    end if
    else 'strKey is a registry valuename
    eExists=false
    end if
    err.clear
    else
    eExists=true
    end if
    on error goto 0
    if bExists=vbTrue then
    sCmd = "reg add ""HKCU\Software\Microsoft\Office\12.0\Outlook\Opti ons\Mail"" /v ""Send Pictures With Document"" /t REG_DWORD /d 1 /f"
    ' Wscript.echo sCmd
    WshShell.Run sCmd ,1,True
    else
    if cExists=vbTrue then
    sCmd = "reg add ""HKCU\Software\Microsoft\Office\14.0\Outlook\Opti ons\Mail"" /v ""Send Pictures With Document"" /t REG_DWORD /d 1 /f"
    ' WScript.echo sCmd
    WshShell.Run sCmd ,1,True
    else
    if dExists=vbTrue then
    sCmd = "reg add ""HKCU\Software\Microsoft\Office\15.0\Outlook\Opti ons\Mail"" /v ""Send Pictures With Document"" /t REG_DWORD /d 1 /f"
    ' WScript.echo sCmd
    WshShell.Run sCmd ,1,True
    else
    if eExists=vbTrue then
    sCmd = "reg add ""HKCU\Software\Microsoft\Office\16.0\Outlook\Opti ons\Mail"" /v ""Send Pictures With Document"" /t REG_DWORD /d 1 /f"
    ' WScript.echo sCmd
    WshShell.Run sCmd ,1,True
    else
    WScript.echo "Nothing to Add"
    end if
    end if
    end if
    end if

  • #2
    There's a comprehensive list of troubleshooting options in this thread on Microsoft's forums. Give it a go.
    A recent poll suggests that 6 out of 7 dwarfs are not happy

    Comment

    Working...
    X