Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete pop3 with vbscript

Status
Not open for further replies.

jonnj

Programmer
Jun 20, 2003
29
0
0
US
Hi everyone,

My company is migrating to Microsoft Exchange Server, but many of the employees still have a pop3 account. What I would like to do without user intervention is to run the vbscript listed below in a nightly push and delete any pop3 accounts and just leave Microsoft Exchange server.

My problem is, I've been unable to write code that finds the pop3 accounts and deletes them.

It is at this point in the code:

ohell.sendkeys "{tab}"
oshell.sendkeys "{tab}"
oshell.sendkeys "{tab}"
oshell.sendkeys "{enter}"
oshell.sendkeys "*r"

oshell.sendkeys "{enter}"
oshell.sendkeys "*y"
oshell.sendkeys "{enter}"....

that I want to be able to identify the pop3 accounts and delete them.

As the script runs nows, it just deletes whatever account is first on the list and in many cases its the Exchange server.

Any help would be greatly appreciated..

Thank you in advance.




Dim oshell

Set oshell = CreateObject("WScript.Shell")
oshell.Run "cmd /K" & chr(34) & "C:\Program Files\Common Files\System\MSMAPI\1033\MLCFG32.CPL"&Chr(34)
oshell.Popup "TEST",1
oshell.AppActivate "Mail Setup - Outlook"

oshell.SendKeys "{enter}"
oshell.SendKeys "{TAB}"
oshell.SendKeys "*n"



oshell.sendkeys "{tab}"
oshell.sendkeys "{tab}"
oshell.sendkeys "{tab}"
oshell.sendkeys "{enter}"
oshell.sendkeys "*r"

oshell.sendkeys "{enter}"
oshell.sendkeys "*y"
oshell.sendkeys "{enter}"


oshell.sendkeys "{tab}"
oshell.sendkeys "{tab}"
oshell.sendkeys "{tab}"
oshell.sendkeys "{tab}"
oshell.sendkeys "{tab}"
oshell.sendkeys "{enter}"

oshell.sendkeys "%{f4}"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'cmd.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

oshell.sendkeys "%{F4}
 
Take a look at redeploying Outlook via AD. Using the custom installation Wizard you can choose to do what you are looking for.

My FAQ on the subject should help you. faq96-4996

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Mark,

Thx for the reply.

I was hoping to avoid redeploying and was trying code like the one below. I can't seem to grab the correct language and make it work. I was looking for soemthing simpler in the script?

Any other suggestions for code??

strComputer = "."
stremail= "aol.com"
Set objComputer = GetObject("WinNT://" & strComputer & "")
objComputer.Delete "email", "stremail"



 
Sorry no other suggestions. Redeploying has the advantage of:

1. getting all users on Outlook 2003
2. patching all versions with the most recent service pack and junk mail filter update
3. allows you to customize the install like get rid of annoying stationary.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top