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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script or GPO to remove Outlook POP3 settings?

Status
Not open for further replies.

Daveyd123

MIS
Aug 25, 2004
413
US
Prior to our installation of Exchange 2003, all users used an external POP3 account to send/receive email. The account settings are setup for each user in Outlook.

When we added our own Exchange server we had to configure everyones Outlook to use Exchange and the external email account.

We are now getting rid of the external email account.

My question is, is there a GPO or a script that could automatically remove the users POP3 settings in Outlook? We have 500+ computers and I don't feel like logging into each PC and deleting the POP3 accounts
 
Again, you need to get away from the concept of runonce as you can not guarantee it.

I would suggest just adding your code to do the work to a login script. In the beginning of the script have it check a registry key, one that you create. Something like:

HKLM\Software\MyCustomSettings with a key called OutlookNoPoP and set it to 1.

If the value is not there or anything other then 1 then have the script run. At the end of running you have it create the key and set the value to 1. That way when the script is next checked it will automatically exit.

Doing it this way you would ensure that all machines would get the fix even if they are off when you initially put the script into the environment.

Sample code:

Code:
On Error Resume Next

Dim olkpath

Set WshShell=CreateObject("WScript.Shell")
olkpath = "HKLM\Software\MyCustomSettings\OutlookNoPoP"

WSHShell.RegRead(olkpath)

If Err Then
	'Code to modify Outlook goes here
	WSHShell.RegWrite olkpath,"1","REG_DWORD"
Else
	'Already been run, exit script
	WScript.Quit
End If

I hope you find this post helpful.

Regards,

Mark
 
So, the final code would look like this?

Code:
On Error Resume Next

Dim olkpath

Set WshShell=CreateObject("WScript.Shell")
olkpath = "HKLM\Software\MyCustomSettings\OutlookNoPoP"

WSHShell.RegRead(olkpath)

If Err Then
    'Code to modify Outlook goes here
C:\Program Files\Microsoft Office\OFFICE11\outlook.exe /importprf \\server\share\office2003\test1.prf 
    WSHShell.RegWrite olkpath,"1","REG_DWORD"
Else
    'Already been run, exit script
    WScript.Quit
End If



 
Almost. You will want to do this instead;
Code:
If Err Then
    'Code to modify Outlook goes here
exeString = "C:\Program Files\Microsoft Office\OFFICE11\outlook.exe /importprf \\server\share\office2003\test1.prf "

    WSHShell.Run(exeString)
    WSHShell.RegWrite olkpath,"1","REG_DWORD"
Else
    'Already been run, exit script
    WScript.Quit
End If

I hope you find this post helpful.

Regards,

Mark
 
OK...script seems to be working except for 1 thing.

It will only let users who have admin privs add the registry key.

I ran the script as a Domain Admin and it worked. I ran it as an ordinary user, an it did not work.

any idea?
 
Set the script in a GPO as a login script and allow the system to do the work. Should work then. If the users do not have rights to the registry key then you may need to look at pushing out a new secedit.sdb file and importing that.

I hope you find this post helpful.

Regards,

Mark
 
OK, put the script in a test GPO and got the following error message:

Line: 51
Char: 1
Error: Invalid root in registry key "HKLM\Software\MyCustomSettings\OutlookNoPoP"
Code: 80070002
Source: WshShell.RegRead
 
Well, I thought i had it figured out but got th same error message as above.

Any thoughts?
 
try running the script manually first to see what you get. Try it as a user first and then as an admin. You might want/need to change the location from HKLM to HKCU if the users don't have write rights to the HKLM registry hive.

I hope you find this post helpful.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top