Exchange 2010 Box not making with Primary SMTP in code.
hi,
You will get more better help from the script forum:http://social.technet.microsoft.com/Forums/en/ITCG/threads
hope can help you
thanks,CastinLu
TechNet Community Support
March 26th, 2012 12:24pm
Rich - the only thing I have ever written in PS is this:
FileNum = FreeFile()
PsInvoke = "Invoke-Command -ComputerName file_center -FilePath NewAccount.ps1"
'Create File on DBCenter
Open Target For Append As #FileNum
Print #FileNum, PsInvoke
Close #FileNum
'Create 2nd Powershell command to execute folder creation, share, and permissions
'New Paths
Target = "\\DBCenter\C$\Documents and Settings\" & userName & "\My Documents\NewAccount.ps1"
PsScript = "$NasPath = 'D:\" & FolderName & "'" & vbNewLine
PsScript = PsScript & "$Shares=[WMICLASS]'WIN32_Share'" & vbNewLine
PsScript = PsScript & "$ShareName='" & sFolderName & "'" & vbNewLine
PsScript = PsScript & "New-Item -type directory -Path $NasPath" & vbNewLine
PsScript = PsScript & "$Shares.Create($NasPath,$Sharename,0,255,$sharename)" & vbNewLine
PsScript = PsScript & "$Acl = Get-Acl $NasPath" & vbNewLine
PsScript = PsScript & "$Ar = New-Object system.security.accesscontrol.filesystemaccessrule('" & sUserName & "','FullControl','ContainerInherit, ObjectInherit', 'None', 'Allow')" & vbNewLine
PsScript = PsScript & "$Acl.AddAccessRule($Ar)" & vbNewLine
PsScript = PsScript & "Set-Acl $NasPath $Acl" & vbNewLine
'Create File on local
Open Target For Append As #FileNum
Print #FileNum, PsScript
Close #FileNum
'Call Powershell and run scripts
Call Shell("powershell -file ""C:\scripts\Com2FC.ps1""", vbMaximizedFocus)
MsgBox "The E:\ Folder has been created."
Do you have a good definitive reference for creating an AD acct and Exch 2010 account with properties and adding them to their groups?
Free Windows Admin Tool Kit Click here and download it now
April 27th, 2012 10:14am
So that is a NO. Ok great thanks for the help - at least I know I was spinning my wheels trying to modify the code to create the Exchange accounts in 2003 to 2010 and that only PS is the way to go.
April 27th, 2012 12:51pm
I have some VBA that creates new user accounts. Mailboxes are creating but there is no Primary SMTP. In 2003 if you set the PrincipalUser and mailNickname it would set the Primary for you. Anyone know that call for this?
' Update User Record
Set oUser = oOU.Create("user", "cn=" & FullName)
oUser.Put "cn", FullName
oUser.Put "SamAccountName", FullName
oUser.Put "userPrincipalName", FullName & "@pbmhmr.com"
oUser.Put "givenName", gname
oUser.Put "sn", sname
oUser.Put "displayName", FullName
oUser.Put "simpleDisplayName", FullName
oUser.Put "mail", MailAlias & "@pbmhmr.com"
oUser.Put "mailNickname", MailAlias
oUser.Put "description", ID
oUser.Put "ScriptPath", "Slogic.bat"
oUser.Put "legacyExchangeDN", "/o=" & Organization & "/ou=" & AdminGroup & "/cn=Recipients/cn=" & MailAlias
oUser.Put "mDBUseDefaults", "TRUE"
oUser.Put "homeMDB", "CN=" & MDBName & ",CN=Databases,CN=" & AdminGroup & ",CN=Administrative Groups,CN=" & Organization & _
",CN=Microsoft Exchange,CN=Services,CN=Configuration," & DomainDN
oUser.Put "homeMTA", "CN=Microsoft MTA,CN=" & Server & ",CN=Servers,CN=" & AdminGroup & ",CN=Administrative Groups,CN=" & Organization & _
",CN=Microsoft Exchange,CN=Services,CN=Configuration," & DomainDN
oUser.Put "msExchHomeServerName", "/o=" & Organization & "/ou=" & AdminGroup & "/CN=Configuration/CN=Servers/CN=" & Server
oUser.Put "msExchRecipientDisplayType", "1073741824"
oUser.Put "msExchRecipientTypeDetails", "1"
oUser.Put "msExchPoliciesIncluded", "{CAF8E0C1-FCD9-48EC-A76E-6D9C7AB75AAF},{26491CFC-9E50-4857-861B-0CB8DF22B5D7}"
oUser.Put "textEncodedORAddress", "X400:C=us;A=;P=" & Organization & ";O=Exchange;S=" & sname & ";G=" & gname & ";"
oUser.Put "showInAddressBook", "CN=Default Global Address List,CN=All Global Address Lists,CN=Address Lists Container," & _
"CN=" & Organization & ",CN=Microsoft Exchange,CN=Services,CN=Configuration," & DomainDN
oUser.Put "proxyAddresses", "smtp:" & Alias & "@pbmhmr.com"
oUser.SetInfo
oUser.GetInfo
Free Windows Admin Tool Kit Click here and download it now
April 27th, 2012 5:53pm
On Thu, 22 Mar 2012 21:35:07 +0000, lmargita wrote:
>I have some VBA that creates new user accounts. Mailboxes are creating but there is no Primary SMTP. In 2003 if you set the PrincipalUser and mailNickname it would set the Primary for you. Anyone know that call for this? ' Update User Record
Exchange 2003 used the Recipient Update Service to do that. There's no
such thing in Exchange 2007 or 2010. Use Powershell to create the user
and mailbox:
http://blogs.msdn.com/b/powershell/archive/2008/07/25/invoking-powershell-from-vbscript-com.aspx
http://powershell.com/cs/blogs/tips/archive/2009/05/29/calling-powershell-from-vbscript.aspx
Or VBS from Powershell:
http://powershell.com/cs/blogs/tips/archive/2009/06/03/calling-vbscript-from-powershell.aspx
> Set oUser = oOU.Create("user", "cn=" & FullName)
> oUser.Put "cn", FullName
> oUser.Put "SamAccountName", FullName
> oUser.Put "userPrincipalName", FullName & "@pbmhmr.com"
> oUser.Put "givenName", gname
> oUser.Put "sn", sname
> oUser.Put "displayName", FullName
> oUser.Put "simpleDisplayName", FullName
> oUser.Put "mail", MailAlias & "@pbmhmr.com"
> oUser.Put "mailNickname", MailAlias
> oUser.Put "description", ID
> oUser.Put "ScriptPath", "Slogic.bat"
> oUser.Put "legacyExchangeDN", "/o=" & Organization & "/ou=" & AdminGroup & "/cn=Recipients/cn=" & MailAlias
> oUser.Put "mDBUseDefaults", "TRUE"
> oUser.Put "homeMDB", "CN=" & MDBName & ",CN=Databases,CN=" & AdminGroup & ",CN=Administrative Groups,CN=" & Organization & _
> ",CN=Microsoft Exchange,CN=Services,CN=Configuration," & DomainDN
> oUser.Put "homeMTA", "CN=Microsoft MTA,CN=" & Server & ",CN=Servers,CN=" & AdminGroup & ",CN=Administrative Groups,CN=" & Organization & _
> ",CN=Microsoft Exchange,CN=Services,CN=Configuration," & DomainDN
> oUser.Put "msExchHomeServerName", "/o=" & Organization & "/ou=" & AdminGroup & "/CN=Configuration/CN=Servers/CN=" & Server
> oUser.Put "msExchRecipientDisplayType", "1073741824"
> oUser.Put "msExchRecipientTypeDetails", "1"
> oUser.Put "msExchPoliciesIncluded", "{CAF8E0C1-FCD9-48EC-A76E-6D9C7AB75AAF},{26491CFC-9E50-4857-861B-0CB8DF22B5D7}"
> oUser.Put "textEncodedORAddress", "X400:C=us;A=;P=" & Organization & ";O=Exchange;S=" & sname & ";G=" & gname & ";"
> oUser.Put "showInAddressBook", "CN=Default Global Address List,CN=All Global Address Lists,CN=Address Lists Container," & _
> "CN=" & Organization & ",CN=Microsoft Exchange,CN=Services,CN=Configuration," & DomainDN
> oUser.Put "proxyAddresses", "smtp:" & Alias & "@pbmhmr.com"
>
> oUser.SetInfo
> oUser.GetInfo
>
>
>
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
April 27th, 2012 9:32pm
On Fri, 23 Mar 2012 13:51:43 +0000, lmargita wrote:
>
>
>Rich - the only thing I have ever written in PS is this:
>
snip ]
>Do you have a good definitive reference for creating an AD acct and Exch 2010 account with properties and adding them to their groups?
new-mailbox
set-user
add-distributiongroupmember
Plus there's whole host of AD commands with Windows 2008 R2.
You'll find lots of examples on creating users, mailboxes, groups,
etc. on many web sites, including technet. There must be dozens of
books on Powershell.
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
April 27th, 2012 10:29pm
hi,
You will get more better help from the script forum:http://social.technet.microsoft.com/Forums/en/ITCG/threads
hope can help you
thanks,CastinLu
TechNet Community Support
April 28th, 2012 5:44am