• 0

Using VB Script to Configure Outlook Express


Question

I have a script I have modified that I found online for what I needed.

set oShell = wscript.CreateObject("Wscript.Shell")

Function main()
	dim username, domain


	username = inputbox("Enter store number","Outlook Express Profile Creator","Username")

	If username = "" Then
  wscript.Quit(0)
  End If
  
  If username = "Username" Then
 	 while username = "Enter store number"
    username = inputbox("Enter store number)","Outlook Express Profile Creator","Username")
   	 If username = "" Then
   	 wscript.Quit(0)
   	 End If
 	 wend
  End If


'	username = Ltrim(fixme(username))
'	domain = fixme2(domain)

'EXAMPLE STRING FOR RTRIM
'	RTrim(string)

	call placeMailSettings(username, domain)

	msgbox("Configuration Completed Successfully, don't forget to set the password!")
End Function

Function regRead(regStr)
  regRead = oShell.RegRead(regStr)
End Function

Function regWrite(val1,val2,val3)
  oShell.RegWrite val1,val2,val3
End Function

Function regDelete(regStr)
  call oShell.RegDelete(regStr)
End Function

'Function fixme(strValue)
'	dim userEntry
'	userEntry = split(strValue, "@")
'	fixme = userEntry(0)
'End Function

'Function fixme2(strValue2)
'	dim userEntryd
'	userEntryd = split(strValue2, "@")
'	fixme2 = userEntryd(0)
'End Function


'EXAMPLE STRING FOR SPLIT
'	Split(expression[,delimiter])



'----------------------------------------------------------------------------------------
' Place new settings for Mail
'----------------------------------------------------------------------------------------

Function placeMailSettings(theUsername, theDomain)
	On Error Resume Next
	dim newAccountNum, numKeyStr
	dim username, domain
	newAccountNum = regRead("HKCU\Software\Microsoft\Internet Account Manager\Account Name")

	If newAccountNum = "" Then
  newAccountNum = "00000001"
	ElseIf newAccountNum < 9 Then
  newAccountNum = "0000000" & newAccountNum
	Else
  newAccountNum = "000000" & newAccountNum	
	End If

	numKeyStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\"
	call regWrite(numKeyStr, newAccountNum, "REG_SZ")

	username = theUsername
	domain = theDomain

	'Add Account Name
   accName = username & " Mail"
   accNameStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\Account Name"
   call regWrite(accNameStr, accName, "REG_SZ")

	'Add Connection Type
   conType = "3"
   conTypeStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\Connection Type"
   call regWrite(conTypeStr, conType, "REG_DWORD")
   
	'Delete Connection Id
   conId = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\ConnectionId"
   call regDelete(conId)
   
	'Delete Account Id
   accId = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\Account ID"
   call regDelete(accId)

	'Delete IMAP Server
   imapSvr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\IMAP Server"
   call regDelete(imapSvr)

	'Delete HTTP Mail Server
   httpSvr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\HTTPMail Server"
   call regDelete(httpSvr)

	'Set POP3 Server
   pop3svr = "insert pop3 server here"
   pop3svrStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\POP3 Server"
   call regWrite(pop3svrStr, pop3svr, "REG_SZ")

	'Set POP3 Username
   pop3usr = username 
   pop3usrStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\POP3 User Name"
   call regWrite(pop3usrStr, pop3usr, "REG_SZ")

	'Set POP3 Password 2
   pop3pwd = username & "$"
   popPwdStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\POP3 Password2"
   call regWrite(popPwdStr, pop3pwd, "REG_BINARY")

	'Set POP3 Use Sicily
   useSicily = "0"
   useSicilyStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\POP3 Use Sicily"
   call regWrite(useSicilyStr, useSicily, "REG_DWORD")

	'Set POP3 Prompt for Pw
   var promptPw = "0"
   var promptPwStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\POP3 Prompt for Password"
   call regWrite(promptPwStr, promptPw, "REG_DWORD")

	'Set SMTP Server
   smtpSvr = "insert server name here"
   smtpSvrStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\SMTP Server"
   call regWrite(smtpSvrStr, smtpSvr, "REG_SZ")
   
	'Set SMTP Display name
   smtpDisp = username & " Mail"
   smtpSvrStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\SMTP Display Name"
   call regWrite(smtpSvrStr, smtpDisp, "REG_SZ")

	'Set SMTP E-mail address
   smtpEmail = username & "@whatever.com"
   smtpEmailStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\SMTP Email Address"
   call regWrite(smtpEmailStr, smtpEmail, "REG_SZ")

	'Set SMTP Use Sicily
   smtpUseSicily = "2"
   smtpUseSicilyStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\SMTP Use Sicily"
   call regWrite(smtpUseSicilyStr, smtpUseSicily, "REG_DWORD")
   
	'Set New Account to default
   defAccStr = "HKCU\Software\Microsoft\Internet Account Manager\Default Mail Account"
   call regWrite(defAccStr, newAccountNum, "REG_SZ")
   
	'Increment future account number
   futAccNum = newAccountNum + 1
   futAccNumStr = "HKCU\Software\Microsoft\Internet Account Manager\Account Name"
   call regWrite(futAccNumStr, futAccNum, "REG_DWORD")
End Function   
   

call main()

My only problems are;

1)It enables SMTP server authentication(I don't need that) <-----Fixed! Thank you Weenur!

2)It will not set(via popup prompt) the password or save it.

I am very new to this and I pieced this together by doing searches, so if it's sloppy, my apologies. Does anyone know how to change this to prompt for the password and save it? Thanks in advance.

Edited by Maleboligia

4 answers to this question

Recommended Posts

  • 0

Great post

I also a noob new to programing..

can you help me to

set leave copy of message -> tick

Incoming port to 995

ssl - tick

outgoing port to 465

ssl - tick.

=========

'Set Leave Mail On Server

var leavemail = "1"

var leavemailStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & "\Leave Mail On Server"

call regWrite(leavemailStr, leavemail, "REG_DWORD")

=============

I tried to modify add the script .. but doesnt work for me.

milion thanks in advanced

Edited by Blue Baby
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • I see you subscribe to the Linux/macOS approach to winning over converts...
    • As we get closer to October 2025 and the end of Windows 10 support, Windows 11 will pick up its pace and soon become the most popular desktop operating system worldwide. That's an assertion. It's also quite possible that the only growth will come from attrition as people and companies buy new machines that only come with Win11. It's also possible that we'll get a literal repeat of Win XP and Win 7, where a large number of users just waited until Microsoft gave in and fixed the core problems that the consumers were complaining about in Win Vista and Win 8 when they released Win 7 and Win 10.
    • It's significant growth for Linux considering the market share, so it could have had that effect I described.
    • Microsoft and Crowdstrike announce partnership on threat actor naming by Pradeep Viswanathan Whenever a cyberattack is discovered, companies disclose it to the public and assign it a unique name based on their internal procedures. Unfortunately, this leads to inconsistencies, as each company has its own naming conventions. As a result, the same threat actor behind a cyberattack may end up with multiple names, causing delays and confusion in response efforts. For example, a threat actor that Microsoft refers to as Midnight Blizzard might be known as Cozy Bear, APT29, or UNC2452 by other security vendors. To address this issue, Microsoft and CrowdStrike are teaming up. These companies will align their individual threat actor taxonomies to help security professionals respond to cyberattacks with greater clarity and confidence. It’s important to note that Microsoft and CrowdStrike are not attempting to create a single naming standard. Instead, they are releasing a mapping that lists common threat actors tracked by both companies, matched according to their respective taxonomies. The mapping also includes corresponding aliases from each group’s naming system. You can view the joint threat actor mapping by Microsoft and CrowdStrike here. Although this threat actor taxonomy mapping is a joint effort between Microsoft and CrowdStrike, Google/Mandiant and Palo Alto Networks' Unit 42 are expected to contribute to this initiative in the future. Vasu Jakkal, Corporate Vice President of Microsoft Security, wrote the following about this collaboration with CrowdStrike: As more organizations join this initiative, the collective defense against cyber threats will undoubtedly be improved.
  • Recent Achievements

    • First Post
      chriskinney317 earned a badge
      First Post
    • Week One Done
      Nullun earned a badge
      Week One Done
    • First Post
      sultangris earned a badge
      First Post
    • Reacting Well
      sultangris earned a badge
      Reacting Well
    • First Post
      ClarkB earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      172
    2. 2
      ATLien_0
      125
    3. 3
      snowy owl
      122
    4. 4
      Xenon
      116
    5. 5
      +Edouard
      93
  • Tell a friend

    Love Neowin? Tell a friend!