Usuário com melhor resposta
Alterar POP e SMTP via policie

Pergunta
-
Respostas
-
Fiz esse script para fazer isso, rode esse script via GPO nas configurações de computador.
Antes de colocar em produção teste em uma ou algumas máquinas manualmente e se tiver algum valor errado ou alguma coisa que esteja diferente do que vc precisa poste.
Salve como vbs.
Set nw = CreateObject("WScript.Network")
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003strOutLookPath = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676\00000003"
strMachineName = "."
strPopServer = "pop3.teste.com.br"
strSMTPServer = "smtp.teste.com.br"popmax = len(strPopServer)
For intLoop = 1 to popmax step 1
asciiPop = asc(mid(strPopServer, intLoop, 1))
if newasciiPop = "" Then
newasciiPop = asciiPop
'newAsciiInitials = asciiPop
else
newasciiPop = newasciiPop & "," & "00" & "," & asciiPop
end ifNext
newasciiPop = newasciiPop & "," & "00" & "," & "00" & "," & "00"
updatePop = Split(newasciiPop,",")SMTPmax = len(strSMTPServer)
For intLoop = 1 to SMTPmax step 1
asciiSMTP = asc(mid(strSMTPServer, intLoop, 1))
if newasciiSMTP = "" Then
newasciiSMTP = asciiSMTP
'newAsciiInitials = asciiSMTP
else
newasciiSMTP = newasciiSMTP & "," & "00" & "," & asciiSMTP
end ifNext
newasciiSMTP = newasciiSMTP & "," & "00" & "," & "00" & "," & "00"
updateSMTP = Split(newasciiSMTP,",")strMoniker = "winMgmts:\\" & strMachineName & "\root\default:StdRegProv"
Set oReg = GetObject(strMoniker)
oReg.EnumKey HKEY_USERS, "", arrSubKeysFor Each subkey In arrSubKeys
strpath = subkey & "\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676"
oReg.EnumKey HKEY_USERS, strpath, arrSubKeys2
If Not IsNull (arrSubKeys2) Then
For Each subkey2 In arrSubKeys2
strPath = subkey & "\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676\" & subkey2
'Wscript.Echo strPath
returnEmail = oReg.GetBinaryValue(HKEY_USERS,strpath,"Email",arrEmailBinary)If Not IsNull (arrEmailBinary) Then
PopServerSet = oReg.SetBinaryValue(HKEY_USERS, strPath, "POP3 Server", updatePop)
SMTPServerSet = oReg.SetBinaryValue(HKEY_USERS, strPath, "SMTP Server", updateSMTP)
POPSSLSet = oReg.SetDWORDValue(HKEY_USERS,strPath,"POP3 Use SSL",1)
POPPortSet = oReg.SetDWORDValue(HKEY_USERS,strPath,"POP3 Port",993)
SMTPConSet = oReg.SetDWORDValue(HKEY_USERS,strPath,"SMTP Secure Connection",2)
SMTPSSLSet = oReg.SetDWORDValue(HKEY_USERS,strPath,"SMTP Use SSL",1)
SMTPPortSet = oReg.SetDWORDValue(HKEY_USERS,strPath,"SMTP Port",587)
End If
Next
End If
NextQualquer dúvida poste e se for útil vote.
Abraço.
Gabriel Nascimento MCP / MCSA / CCNA http://gabrielnascimentoit.spaces.live.com -- Se for útil vote.- Sugerido como Resposta Gabriel R S Nascimento terça-feira, 11 de maio de 2010 14:53
- Marcado como Resposta Fábio JrModerator sexta-feira, 13 de janeiro de 2012 15:35
Todas as Respostas
-
-
-
Fiz esse script para fazer isso, rode esse script via GPO nas configurações de computador.
Antes de colocar em produção teste em uma ou algumas máquinas manualmente e se tiver algum valor errado ou alguma coisa que esteja diferente do que vc precisa poste.
Salve como vbs.
Set nw = CreateObject("WScript.Network")
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003strOutLookPath = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676\00000003"
strMachineName = "."
strPopServer = "pop3.teste.com.br"
strSMTPServer = "smtp.teste.com.br"popmax = len(strPopServer)
For intLoop = 1 to popmax step 1
asciiPop = asc(mid(strPopServer, intLoop, 1))
if newasciiPop = "" Then
newasciiPop = asciiPop
'newAsciiInitials = asciiPop
else
newasciiPop = newasciiPop & "," & "00" & "," & asciiPop
end ifNext
newasciiPop = newasciiPop & "," & "00" & "," & "00" & "," & "00"
updatePop = Split(newasciiPop,",")SMTPmax = len(strSMTPServer)
For intLoop = 1 to SMTPmax step 1
asciiSMTP = asc(mid(strSMTPServer, intLoop, 1))
if newasciiSMTP = "" Then
newasciiSMTP = asciiSMTP
'newAsciiInitials = asciiSMTP
else
newasciiSMTP = newasciiSMTP & "," & "00" & "," & asciiSMTP
end ifNext
newasciiSMTP = newasciiSMTP & "," & "00" & "," & "00" & "," & "00"
updateSMTP = Split(newasciiSMTP,",")strMoniker = "winMgmts:\\" & strMachineName & "\root\default:StdRegProv"
Set oReg = GetObject(strMoniker)
oReg.EnumKey HKEY_USERS, "", arrSubKeysFor Each subkey In arrSubKeys
strpath = subkey & "\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676"
oReg.EnumKey HKEY_USERS, strpath, arrSubKeys2
If Not IsNull (arrSubKeys2) Then
For Each subkey2 In arrSubKeys2
strPath = subkey & "\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676\" & subkey2
'Wscript.Echo strPath
returnEmail = oReg.GetBinaryValue(HKEY_USERS,strpath,"Email",arrEmailBinary)If Not IsNull (arrEmailBinary) Then
PopServerSet = oReg.SetBinaryValue(HKEY_USERS, strPath, "POP3 Server", updatePop)
SMTPServerSet = oReg.SetBinaryValue(HKEY_USERS, strPath, "SMTP Server", updateSMTP)
POPSSLSet = oReg.SetDWORDValue(HKEY_USERS,strPath,"POP3 Use SSL",1)
POPPortSet = oReg.SetDWORDValue(HKEY_USERS,strPath,"POP3 Port",993)
SMTPConSet = oReg.SetDWORDValue(HKEY_USERS,strPath,"SMTP Secure Connection",2)
SMTPSSLSet = oReg.SetDWORDValue(HKEY_USERS,strPath,"SMTP Use SSL",1)
SMTPPortSet = oReg.SetDWORDValue(HKEY_USERS,strPath,"SMTP Port",587)
End If
Next
End If
NextQualquer dúvida poste e se for útil vote.
Abraço.
Gabriel Nascimento MCP / MCSA / CCNA http://gabrielnascimentoit.spaces.live.com -- Se for útil vote.- Sugerido como Resposta Gabriel R S Nascimento terça-feira, 11 de maio de 2010 14:53
- Marcado como Resposta Fábio JrModerator sexta-feira, 13 de janeiro de 2012 15:35
-
-
Gabriel, boa tarde. Sou leigo no assunto (VBS e GPO) e estou passando por um problema similar.
Atualmente utilizo exchange em meu parque e vamos alterar o servidor de e-mail, consequentemente, precisamos alterar de forma automática as configurações de centenas de usuários no outlook (SMTP e POP).
Temos Outlook 2007, 2010, 2013 e 2016.
Como posso criar GPO para aplicar essa mudança de servidor?
Muito obrigado.