Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Script for account creation fails after SP3 RU4

Posted on 2014-02-20
5
Medium Priority
?
376 Views
Last Modified: 2014-03-02
We use a PowerShell script to automatically generate student accounts when they register. It was working fine until the other night when we applied updates (I can supply the entire list if needed.) Rollup 4 was one of the updates. Now when the script runs, it creates the first account in the list and then throws anerror. Ideally, I'd like to fix it. Rollups don't seem to consistently remove cleanly. Here's the error that gets thrown in PS:

The type initializer for 'Microsoft.Exchange.Diagnostics.ExTraceConfiguration' threw an exception.
    + CategoryInfo          : OperationStopped: (System.Manageme...pressionSyncJob:PSInvokeExpressionSyncJob) [], PSRe
   motingTransportException
    + FullyQualifiedErrorId : JobFailure

Open in new window


My execution policy is currently set to unrestricted, so it's not that. In the event log the following two errors are generated:

Log Name:      Application
Source:        Windows Error Reporting
Date:          2/19/2014 8:37:51 AM
Event ID:      1001
Task Category: None
Level:         Information
Keywords:      Classic
User:          N/A
Computer:      <myservername>.lhup.edu
Description:
Fault bucket , type 0
Event Name: PowerShell
Response: Not available
Cab Id: 0

Problem signature:
P1: powershell.exe
P2: 6.1.7601.17514
P3: System.NullReferenceException
P4: System.TypeInitializationException
P5: unknown
P6: oft.Exchange.Diagnostics.SystemTraceControl.Update
P7: unknown
P8: 
P9: 
P10: 

Attached files:

These files may be available here:


Analysis symbol: 
Rechecking for solution: 0
Report Id: c8a838b5-996a-11e3-8362-005056b67715
Report Status: 0
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Windows Error Reporting" />
    <EventID Qualifiers="0">1001</EventID>
    <Level>4</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-02-19T13:37:51.000000000Z" />
    <EventRecordID>4104059</EventRecordID>
    <Channel>Application</Channel>
    <Computer>mail2.lhup.edu</Computer>
    <Security />
  </System>
  <EventData>
    <Data>
    </Data>
    <Data>0</Data>
    <Data>PowerShell</Data>
    <Data>Not available</Data>
    <Data>0</Data>
    <Data>powershell.exe</Data>
    <Data>6.1.7601.17514</Data>
    <Data>System.NullReferenceException</Data>
    <Data>System.TypeInitializationException</Data>
    <Data>unknown</Data>
    <Data>oft.Exchange.Diagnostics.SystemTraceControl.Update</Data>
    <Data>unknown</Data>
    <Data>
    </Data>
    <Data>
    </Data>
    <Data>
    </Data>
    <Data>
    </Data>
    <Data>
    </Data>
    <Data>
    </Data>
    <Data>0</Data>
    <Data>c8a838b5-996a-11e3-8362-005056b67715</Data>
    <Data>0</Data>
  </EventData>
</Event>


Log Name:      Application
Source:        Windows Error Reporting
Date:          2/19/2014 8:37:51 AM
Event ID:      1001
Task Category: None
Level:         Information
Keywords:      Classic
User:          N/A
Computer:      <myservername>.lhup.edu
Description:
Fault bucket , type 0
Event Name: PowerShell
Response: Not available
Cab Id: 0

Problem signature:
P1: powershell.exe
P2: 6.1.7601.17514
P3: System.NullReferenceException
P4: System.TypeInitializationException
P5: unknown
P6: oft.Exchange.Diagnostics.SystemTraceControl.Update
P7: unknown
P8: 
P9: 
P10: 

Attached files:

These files may be available here:
C:\Users\Administrator.DOMAIN1\AppData\Local\Microsoft\Windows\WER\ReportArchive\Critical_powershell.exe_4fabcdf7532bfe17a44cd45b511ce052e7717_25de96ae

Analysis symbol: 
Rechecking for solution: 0
Report Id: c8a838b5-996a-11e3-8362-005056b67715
Report Status: 0
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Windows Error Reporting" />
    <EventID Qualifiers="0">1001</EventID>
    <Level>4</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-02-19T13:37:51.000000000Z" />
    <EventRecordID>4104058</EventRecordID>
    <Channel>Application</Channel>
    <Computer>mail2.lhup.edu</Computer>
    <Security />
  </System>
  <EventData>
    <Data>
    </Data>
    <Data>0</Data>
    <Data>PowerShell</Data>
    <Data>Not available</Data>
    <Data>0</Data>
    <Data>powershell.exe</Data>
    <Data>6.1.7601.17514</Data>
    <Data>System.NullReferenceException</Data>
    <Data>System.TypeInitializationException</Data>
    <Data>unknown</Data>
    <Data>oft.Exchange.Diagnostics.SystemTraceControl.Update</Data>
    <Data>unknown</Data>
    <Data>
    </Data>
    <Data>
    </Data>
    <Data>
    </Data>
    <Data>
    </Data>
    <Data>C:\Users\Administrator.DOMAIN1\AppData\Local\Microsoft\Windows\WER\ReportArchive\Critical_powershell.exe_4fabcdf7532bfe17a44cd45b511ce052e7717_25de96ae</Data>
    <Data>
    </Data>
    <Data>0</Data>
    <Data>c8a838b5-996a-11e3-8362-005056b67715</Data>
    <Data>0</Data>
  </EventData>
</Event>

Open in new window


The report.wer file:

Version=1
EventType=PowerShell
EventTime=130372905673297717
ReportType=1
Consent=1
ReportIdentifier=c8a838b5-996a-11e3-8362-005056b67715
Response.type=4
Sig[0].Name=NameOfExe
Sig[0].Value=powershell.exe
Sig[1].Name=FileVersionOfSystemManagementAutomation
Sig[1].Value=6.1.7601.17514
Sig[2].Name=InnermostExceptionType
Sig[2].Value=System.NullReferenceException
Sig[3].Name=OutermostExceptionType
Sig[3].Value=System.TypeInitializationException
Sig[4].Name=DeepestPowerShellFrame
Sig[4].Value=unknown
Sig[5].Name=DeepestFrame
Sig[5].Value=oft.Exchange.Diagnostics.SystemTraceControl.Update
Sig[6].Name=ThreadName
Sig[6].Value=unknown
DynamicSig[1].Name=OS Version
DynamicSig[1].Value=6.1.7601.2.1.0.274.10
DynamicSig[2].Name=Locale ID
DynamicSig[2].Value=1033
UI[3]=powershell has stopped working
UI[4]=Windows can check online for a solution to the problem.
UI[5]=Check online for a solution and close the program
UI[6]=Check online for a solution later and close the program
UI[7]=Close the program
FriendlyEventName=PowerShell
ConsentKey=PowerShell
AppName=powershell
AppPath=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Open in new window


The generation script follows:

Import-Module ActiveDirectory
Import-CSV c:\addusers\accounts.csv | % {
 $pass = ConvertTo-SecureString -AsPlainText $_.Password -Force
 New-Mailbox -Name $_.Name `
  -FirstName $_.FirstName `
  -LastName $_.LastName `
  -Initials $_.Initials `
  -Alias $_.Alias `
  -SamAccountName $_.SamAccountName `
  -UserPrincipalName $_.UserPrincipalName `
  -Password $pass `
  -ResetPasswordOnNextLogon:$True `
  -OrganizationalUnit $_.OrganizationalUnit `
  -Database $_.Database `

 Set-User -Identity $_.Name `
  -DisplayName $_.DisplayName `
  -Notes $_.Notes `

Start-Sleep -s 30

 Set-ADuser -Identity $_.Alias `
  -homeDrive $_.homeDrive `
  -homeDirectory $_.homeDirectory `
  -scriptPath $_.scriptPath `
  -description $_.description `
}

Open in new window


Many thanks in advance!
0
Comment
Question by:jrwalker1048
  • 4
5 Comments
 
LVL 12

Expert Comment

by:Gary Dewrell
ID: 39873605
http://support.microsoft.com/kb/979801

This article says that problem was supposedly resolved in roll up 4, not caused by it but take a look at the work around section. Maybe this will get it you pointed in the right direction.

God Bless
0
 

Author Comment

by:jrwalker1048
ID: 39873750
Thanks for the tip gdewrell, but I don't even have any traces enabled.
0
 

Author Comment

by:jrwalker1048
ID: 39876443
Update: Uninstalled RU4 to no avail. It must have been one of the windows or .net updates that ran that night.
0
 

Accepted Solution

by:
jrwalker1048 earned 0 total points
ID: 39885937
Solved it. I had to pass the credentials at the beginning of the powershell script thanks to whatever patch/update was responsible for borking it.
0
 

Author Closing Comment

by:jrwalker1048
ID: 39898368
I dug up the answer on my own.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
Microsoft Jet database engine errors can crop up out of nowhere to disrupt the working of the Exchange server. Decoding why a particular error occurs goes a long way in determining the right solution for it.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question