![]() |
|
Spaces home Ron Williams IT BlogPhotosProfileFriendsMore ![]() | ![]() |
Ron Williams IT BlogWriteups related to Microsoft infrastructure technologies
|
|||||||||
|
October 10 VBScript to Create Mail Enabled Users with Populated MailboxesHere is a vbscript that I wrote that will create a specified number of Exchange 2003 mail enabled TestUsers with populated mailboxes. It really helps when creating (and recreating) lab users to test Active Directory and Exchange migrations in a Proof Of Concept (POC). It should be run from an Exchange 2003 box in a non-production environment.
Here is what it does:
1. Creates Root level OU called TestOU
2. Creates a specified number of users in that OU
3. Creates mailboxes for all those users (mailbox enabled users)
4. Waits 60 seconds
5. Fills each mailbox with a specified number of emails using SMTP
Here is the syntax:
cscript scriptname.vbs (Number of Users) (SMTP Namespace specified in Recipient Policies) (Number of Emails to Create) (Name of the mailbox store) (Active Directory Domain Name)
For example, to create 50 users with 10 emails in each mailbox, here is the command:
cscript CreateRecipients.vbs 50 "domain.com" 10 "Mailbox Store (EX2003)" "domain.local" 'This script creates an OU called TestOU in the root of the domain.
'Then it creates the specified number of mailbox enabled users which are not disabled
'All users have the same password
'Then it populates their inboxes with the specified number of emails.
'Always enclose arguments with spaces in quotes,
'Seperate the arguments with a space
'Should be run on the exchange 2003 server in a lab environment.
'For help, email ron dot williams at mail dot com
'Arguments= (number of test mailboxes)(domain name)(number of test emails to create)(name of mailbox store) (Active Directory Domain Name)
'an example of the command used to run this script to create 50 users with 10 emails in each mailbox is:
'cscript CreateRecipients.vbs 50 "domain.com" 10 "Mailbox Store (EX2003)" "domain.local"
'Argument1 = oArgs.Item(0) = number of test users to create
'Argument2 = oArgs.Item(1) = SMTP namespace domain name of the recipients ie "domain.com" is the domain name for TestUser1@domain.com
'Argument3 = oArgs.Item(2) = number of test emails to create
'Argument4 = oArgs.Item(3) = home MDBname, for example "Mailbox Store (EX2003)" this can be found in exchange System Manager next to the mailbox database
'Argument5 = oArgs.Item(4) = Active Directory Domain Name domain name of active directory "domain.local" This may or may not be the same as the SMTP namespace.
Set oArgs=WScript.Arguments
If oArgs.Count < 5 Then 'if the script is run with less than nine arguments, it errors out.
Set objShell = Wscript.CreateObject("Wscript.Shell") objShell.LogEvent EVENT_TYPE_ERROR, _
"Script was run with an incorrect number of arguments."
wscript.echo "Script was run with an incorrect number of arguments."
WScript.Quit -1
End If
'get the domain DN from the oArgs.Item(4)argument
DomainDN = "dc=" & Replace(oArgs.Item(4),".",",dc=")
'Create the OU "TestOU" to house the user objects
'on Error Resume Next
Set objDomain = GetObject("LDAP://" & DomainDN)
Set objOU = objDomain.Create("organizationalUnit", "ou=TestOU")
objOU.SetInfo
'Create Users
On Error Resume Next
For CountUsers = 1 to oArgs.Item(0)
"Test_User" & CountUsers ' this will be the user principle name TestUser1 TestUser2 etc FirstName = "Test_"
LastName = "User" & CountUsers
objRootLDAP.Get( "defaultNamingContext"))
' Create the actual User.
Set objNewUser = objContainer.Create("User", "cn=" & emailname)
objNewUser.Put "sAMAccountName", EMailName
objNewUser.Put "sn", LastName
objNewUser.Put "givenName", FirstName
objNewUser.Put "userPrincipalName", emailname
objNewUser.SetInfo
objNewUser.SetPassword "Password1"
objNewUser.AccountDisabled = False
objNewUser.SetInfo
Next
wscript.echo "Created " & oArgs.Item(0) & " users."
'The next section creates Mailboxes for all users in TestOU
'from http://telnetport25.wordpress.com/2007/10/05/creating-mailboxes-for-user-accounts-that-already-exist-exchange-2003/
strOU = "OU=TestOU"
strStore = oArgs.Item(3)
Set NC = GetObject("LDAP://RootDSE")
Set oIADS = GetObject("LDAP://RootDSE")
strConfContext = NC.Get( "defaultnamingcontext")
strADSPath = "LDAP://" & strOU & "," & oIADS.Get("defaultNamingContext")
Set objCommand = CreateObject("ADODB.Command")
Set objConn = CreateObject("ADODB.Connection")
objConn.Open "Provider=ADsDSOObject;"
Set objCommand.ActiveConnection = objConn
objCommand.CommandText = "SELECT distinguishedName FROM "+"'"+strADsPath+"'"+" WHERE objectClass = 'user'"
objCommand.Properties( "searchscope") = 2
objCommand.Properties( "Page Size") = 1000
Set objRecordSet = objCommand.Execute
While Not objRecordSet.EOF
Set oIADSUser = GetObject("LDAP://" & objRecordSet.Fields("distinguishedName")) Set oMailBox = oIADSUser oMailbox.CreateMailbox FindAnyMDB( "CN=Configuration," & strConfContext)
oIADSUser.SetInfo
objRecordSet.MoveNext
Wend
Dim oConnection Dim oCommand Dim oRecordSet Dim strQuery Set oConnection = CreateObject("ADODB.Connection") set oCommand = CreateObject("ADODB.Command") Set oRecordSet = CreateObject("ADODB.Recordset") oConnection.Provider = "ADsDSOObject"
oConnection.Open "ADs Provider"
strQuery = "<LDAP://" & strConfigurationNC & ">;(Name=" & strStore & ");name,adspath;subtree"
oCommand.ActiveConnection = oConnection
oCommand.CommandText = strQuery
Set oRecordSet = oCommand.Execute
If Not oRecordSet.EOF Then
CStr(oRecordSet.Fields("ADsPath").Value) Else FindAnyMDB = ""
End If
oRecordSet.Close
oConnection.Close
Set oRecordSet = Nothing
Set oCommand = Nothing
Set oConnection = Nothing
End Function
wscript.echo "Mailbox enabled " & oArgs.Item(0) & " users."
'wait 60 seconds
cscript.echo "Waiting for 60 seconds...."
Wscript.Sleep 60000
wscript.echo "Sending " & oArgs.Item(1) & " emails..."
'Use SMTP to create mass emails to activate and populate the email boxes
For CountMailboxes = 1 To oArgs.Item(0)
"Test_User" & CountMailboxes &"@" & oArgs.Item(1) For CountEmails = 1 To oArgs.Item(2) set objEmail = CreateObject("CDO.Message") objEmail.From = "TestSender@MassEmailScript.com"
objEmail.To = varDestUser
objEmail.Subject = "Testing Email Number " & CountEmails
objEmail.Textbody = "Testing Email message body number " & CountEmails
objEmail.Send
Next
Next
wscript.echo "Done! Check Active Directory Users and Computers to verify " _
& "the existence of the TestOU and the Test_Users. Use Exchange System Manager " _
& "to verify that mailboxes were created and populated."
'Clear Arguments out of memory
set oArgs=Nothing
October 09 Blog Comment SpamI am getting a TON of comment spam from people with World of Warcraft gold and people selling old LCD's. I get notified of new comments on the windows live spaces home page, but there isnt a link to delete the comments from there (come on MS, catch up to MySpace... kidding, kidding).
There is a link on the MOBILE version of live spaces that will allows you to delete each comment. You can only do one commment at a time, and you have to verify that you want to delete each one, but it's less clicks than using the full interface.
1. Browse to YourSpaceNameHere.MOBILE.spaces.live.com
2. Click Delete this Comment under the comment you want to delete.
3. Verify the deletion
4. Done!
I am eagerly awaiting the following features in Live Spaces:
1. The ability to delete comments in bulk and from a central place
2. Comment Verification using Captcha verification, to avoid BOT comments
3. Limiting the number of comments per time period
4. Email and or Live Messenger alerts when new comments are added
5. The ability to approve comments before they are added to your space
6. The ability to reply to each comment without having to add a new comment. October 05 AirTunes Stop Working After Upgrade to iTunes 8.0After upgrading to iTunes 8, my music streaming from iTunes to my stereo stopped working. I was getting the following error: "An error occurred while connecting to the remote speaker 'speaker_name'. An unknown error occurred (-3256)." I was running the latest firmware (6.3) on my Airport Express, and running iTunes 8.0 on Windows Vista SP1. I tried reinstalling iTunes, AirPort Admin Utiliity, turning off AirTunes on the AirPort Admin utility, then turning it back on, but I was still getting the same error. Finally I found info about the error in the Apple forums here: http://discussions.apple.com/thread.jspa?messageID=8225777 Upon investigation, it looked like that windows firewall was blocking the ports I needed. But I knew my Windows Firewall Service was disabled (I know, I know, bad me...) I tried to start the windows firewall service, and it failed with the following error in the System Event Log: The Windows Firewall service terminated with service-specific error 5 (0x5). UGH. Found the following MS article: http://support.microsoft.com/kb/943996 Fixed the registry keys as required and got my firewall service started, and AirTunes worked! I discovered iTunes 8.0 will not connect to remote speakers (at least on Windows Vista) if the Windows Firewall service is disabled or stopped. I verified this by disabling the service again, and AirTunes stopped working. Once I started the service, I was able to stream music. yay August 29 Hyper-V Virtual Machines wont start with Errors 17040 and 15500Synopsis: We have a Hyper-V Host server running Server 2008 Datacenter with Hyper-V RTM. On this host we have several guest machines: 1. Domain Controller 2. DPM 3. VMM 4. Etc
The host OS had a VMM agent which happened to be managed by Virtual Machine Manager which was running on guest OS #3. In other words, the guest was managing the host.
After installing some windows updates and rebooting the host OS, none of the VM’s would boot, with a dialog box saying that the machines were "unable to start." Clicking on details would show "ServerName failed to start worker process: The extended attributes are inconsistent. (0x800700FF)."
The following errors showed in the event log:
Log Name: Microsoft-Windows-Hyper-V-VMMS-Admin Source: Microsoft-Windows-Hyper-V-VMMS Date: 8/29/2008 1:04:57 PM Event ID: 15500 Task Category: None Level: Error Keywords: User: SYSTEM Computer: Hyper-V Servername Description: 'CATDEMO-DC' failed to start worker process: The extended attributes are inconsistent. (0x800700FF). (Virtual machine ID C6A6A456-C58A-45BE-93D4-A94081481267)
Log Name: Microsoft-Windows-Hyper-V-Worker-Admin Source: Microsoft-Windows-Hyper-V-Worker Date: 8/29/2008 1:07:06 PM Event ID: 17040 Task Category: None Level: Error Keywords: User: NETWORK SERVICE Computer: Hyper-V Servername Description: The authorization store could not be initialized from storage location 'msxml://C:\ProgramData\Microsoft\Virtual Machine Manager\HyperVAuthStore.xml'. Error: General access denied error (0x80070005).
Resolution: 1. Back up the C:\ProgramData\Microsoft\Virtual Machine Manager\HyperVAuthStore.xml file by copying it to the desktop 2. Change security on C:\ProgramData\Microsoft\Virtual Machine Manager\HyperVAuthStore.xml, give “EVERYONE” read access to the file. 3. Start your virtual machines.
The recommended resolution is to reinstall the VMM agent from the VMM server, but this wasn’t possible since the VMM server was a virtual that wouldn’t start. This is a known error with VMM
Related Articles: http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=3469073&SiteID=17 http://www.expta.com/2008/06/vmm-2008-managed-hyper-v-s-wont-start.html August 22 Enable Agent Proxying using a GUI Tool in Operations Manager 2007I know all my fellow OpsMgr peeps are saying they have known about this tool for a while, but I just started using it to enable proxying on a group of agents. I scoffed at it before, because I prided myself in being able to use command line tools. But this tool is just too helpful to ignore! Download it here from http://blogs.msdn.com/boris_yanushpolsky/archive/2007/08/02/enabling-proxying-for-agents.aspx August 20 Installing ADSIedit on Server 2008I searched the internets high and low to find out how to add ADSIedit to a Server 2008 member server. In previous versions of Windows, you installed ADSIedit and the other Windows Support Tools from the server installation media. One of the main benefits of Server 2008 is that you should never have to insert the installation media again after the initial install. No more being asked to insert the Windows 2003 SP2 CD (did this CD ever really exist?? I didn't think so...) The Windows Support Tools are now included in the RSAT (Remote Server Administration Tools) and can be installed as features in Server 2008. ADSIedit is part of the Active Directory Domain Controller Tools feature, and can be added by following these steps:
Cameron Fuller let me know that these tools are also installed when you add the Active Directory Role to a server. Installing SQL Reporting Services on Server 2008I installed SQL 2005 Std 64-bit Reporting Services using a default configuration on a clean install of Server 2008. I followed all the steps in Microsoft’s KB http://support.microsoft.com/kb/938245 entitled “How to install and how to configure SQL Server 2005 Reporting Services on a computer that is running Windows Server 2008” but was still getting an error when browsing to http://localhost/reports or http://servername/reports : “Error. Unable to connect to the remote server” Here is how I fixed it:
I found the solution here: August 06 How to Enable Proxy on all AgentsProxyCFG for Operations Manager is a really cool to to allow you to enable agent proxy on a group of Agents. Agent proxy is needed for certain discovery tasks. For example, for clusters, or for the Active Directory Management Pack...
Download the tool here http://home.comcast.net/~the_eastwoods/MOMDownloads/Proxycfg.zip
if you wanted to enable proxy on all computers (which is not a best practice, but can help in troubleshooting MP's), use the following command:
ProxyCFG.exe -GroupProxyOn "All Computers" August 05 ReSearchThis! Management Pack for Operations Manager 2007This is one of my favorite add on management packs. It adds Tasks that allow an OpsMgr user to highlight an alert and submit a search to the SystemCenterForum knowledge base for answers, as well as share their own solutions with the community.
It's like adding a whole new knowlege base of community knowledge for alerts in OpsMgr.
Alert Forward Management Pack 3.0 for OpsMgr 2007 SP1Here is a link to download the latest version of my Alert Forward management pack for Operations Manager 2007 SP1:
It allows you to select any alert in an alert view in the console, and forward that alert to an email recipient. It checks to see if Outlook is installed, and if so, allows you to send the email using Outlook (through CDO). Otherwise, it uses an SMTP server to relay the email.
The slickest part of the management pack (if i do say so myself, thank you very much) is the setup.exe installer that I wrote in VB.NET using the OpsMgr SDK. Here are the tasks it performs:
Here are the alert parameters that are sent in the email:
<Parameter>"$MonitoringObjectName$"</Parameter> <Parameter>"$Name$"</Parameter> <Parameter>"$Description$"</Parameter> <Parameter>"$TimeRaised$"</Parameter> <Parameter>"$Severity$"</Parameter> Let me know if you have any questions about it. RON DOT WILLIAMS AT MAIL DOT COM July 31 VMbus Failure in 32-bit Server 2008 VHDI recently decided installed Server 2008 with Hyper-V on my laptop and migrated all my virtual PC machines. If you use a Server 2008 32-bit vhd created in Virtual PC, you may not be able to install and use Hyper-V integration services. The mouse service will not perform correctly and your network devices will not show up. The VMbus will show a warning yellow icon in device manager and will say that there aren’t enough IRQ’s to load the bus. In MSCONFIG, I changed the advanced boot options to check HAL when loading boot.ini and it fixed the problem. Monitoring Multiple Domains with Operations Manager 2007I just realized, after much pre-deployment fretting, that it is very simple to assign multiple action accounts to the Active Directory Management pack. Domain controllers in different domains need different action accounts for Active Directory monitoring to work. Here is how you do it: 1. Go to OpsMgr console>Administration>Security>Run As Accounts. 2. Create an new action account for each of the domains that you will be monitoring. Use “windows” as the type, and be careful typing the password, they are not validated in this field. 3. Go to Administration>Security>Run As Profiles and double click AD MP Account. Click on the Run As Accounts Tab 4. Associate the account to each domain controller by clicking on New… You must manually select each domain controller and choose an account on a by-machine basis. June 16 Avoiding Nervousness when PresentingI have a meeting at one of my really large clients, and for some reason I was a little nervous. I found a some helpful links related to being a better presenter. Basically they say to not try to avoid nervousness, but to work with it and accept it for what it is: http://presenting2007.blogspot.com/2007/02/notes-on-being-nervous.html http://www.professionalspeakers.org/cgi-bin/allegro.pl?article115 http://www.thepublicspeakingsite.com/ http://eirikso.com/2008/06/04/what-to-do-if-you-are-nervous-when-presenting/ June 12 Helpful Links related to Configuring Outlook Anywhere nee 'RPC over HTTPS'I had a client who wanted some helpful links to articles about Outlook Anywhere. Here is what i found: Configuring Outlook Anywhere http://exchange-genie.blogspot.com/2008/02/configuring-outlook-anywhere-for.html
How to Configure Outlook Anywhere in Exchange 2007 http://technet.microsoft.com/en-us/library/cc179036(TechNet.10).aspx
Tutorial on Setting Up Outlook Anywhere with ISA (ignore the ISA part) http://www.msexchange.org/tutorials/Outlook-Anywhere-2007-ISA-Server-2006.html
Configuring an Outlook 2003 Client: http://www.msexchange.org/tutorials/outlookrpchttp.html You for any client not running outlook 2007, you will have to manually configure the rpc over http settings. Outlook 2007 will automatically configure itself using the autodiscover feature
System Center Capacity Planner Download http://technet.microsoft.com/en-us/sccp/bb969059.aspx
Technet Articles: http://technet.microsoft.com/en-us/library/bb123741.aspx http://technet.microsoft.com/en-us/library/7f885b45-cbd4-4349-bdd2-bc1f30fbe1b4.aspx June 03 MCTS: Operations Manager 2007. Test 70-400 Notes
Last week, I took 70-400 to get my MCTS:Microsoft System Center Operations Manager 2007, Configuring.
Here is what I remember about the test: · 47 total questions, 2 hours long · All multiple choice with four answers · There weren’t any “All of These” or “None of these” answer possibilities · About 5 questions that allow multiple answers, but all specify the total number of answers that you choose, ie “choose two of the following.” · There weren’t any definition questions · All the questions were task-based and follow the format: You would like to <do something>. In order to accomplish this you must <choose answer>. · Several questions related to backup/restore. Study different backup/restore scenarios, especially related to the loss of an RMS · Know how to replicate an environment in a lab by copying the databases and restoring the encryption key · Know which roles to which restore the encryption key · Study SecureStorageBackup.exe syntax · Study ManagementServerConfigTool.exe PromoteRMS syntax · Study the export-managementpack cmdlet syntax · Know how to install a Gateway server to monitor servers in a DMZ · Know how to authenticate agents using certificates in a DMZ, and how to use MOMcertimport.exe · Study Audit Collection Services know how to turn it on and off on agents, and how to install on the server. Also remember that you cant install on a server that is clustered. · Study Agentless Exception Monitoring, know how to filter the results so not all exceptions are sent to MS · Know how to use overrides to target a MP to a specific type of target (like all Server 2003 domain controllers for example) · Remember that to discover cluster resources, you have to turn on agent proxying on the physical nodes · Remember that to see reports related to specific MP’s, you have to import the MP’s · Know the basic steps for creating a distributed application · Know how to monitor a web site using synthetic transactions, and remember what situations would be appropriate for monitoring a site using synthetic transactions · Know when to create a diagnostic task vs. a recovery task · Know the difference between a console task an agent task VBscript to Determine if Outlook is installedI am writing a script that will do one thing if outlook is installed, and do another if outlook isn't installed. I tried all kinds of logical file checks etc to see if the outlook binaries existed, but it got complicated. I decided to see if the outlook object would successfully initialize. If I cannot connect to the outlook application, then I can probably assume that outlook is not installed: on error resume next May 12 Expanding a Boot VHD on a Domain Controller
I have domain controller in my lab running on Virtual PC 2007 whose boot disk was running out of space. It was originally formatted as a dynamic expanding disk with a maximum size of 16 Gb, and had reached its capacity. The virtual machine is also running OpsMgr and SQL 2005. I tried using VHDresizer available at http://vmtoolkit.com/files/folders/converters/entry87.aspx but could not get it to work. VHDresizer is slightly annoying for two reasons:
Here is how I cloned the boot partition to a larger VHD:
April 21 Uninstalling Reporting in OpsMgr, then Reinstalling SQL Reporting Services
I was running OpsMgr Reporting, OpsMgr DB, DW, and RMS all on one server install. I set up scheduled reporting to email a report on a weekly basis. The links in the emails being sent were not working. I read a post somewhere, and thought it said to uninstall OpsMgr reporting, then reinstall. Looking back, I think i may have misread the post, because this was a bad idea (and i cant find the post anymore). Here is what i did, and what i had to do to fix the problem. Also, the original problem of the links not working in the scheduled email reports is a known-issue in SQL Reporting Services. See http://support.microsoft.com/kb/949454/en-us Here is what I did:
This seemed to fix the issue, and everything is working properly now. The moral of the story is to take a breather when you start to panic. Also, always lab test database changes, and have a reliable, tested backup. April 04 Installing a Gateway ServerOpsMgr Gateway Server Installation Notes: I have a client that has 10-15 servers in a workgroup in a DMZ that they need to manage using OpsMgr 2007. We chose to install the role on a virtual server that resides in the DMZ. They did not have a certificate authority to issue certificates, which are required in this setup, so we installed certification services on the same virtual server as the gateway role. Here are my notes:
| ||||||||