Script for account creation fails after SP3 RU4

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!
jrwalker1048Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
jrwalker1048Connect With a Mentor Author Commented:
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
 
Gary DewrellSenior Network AdministratorCommented:
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
 
jrwalker1048Author Commented:
Thanks for the tip gdewrell, but I don't even have any traces enabled.
0
 
jrwalker1048Author Commented:
Update: Uninstalled RU4 to no avail. It must have been one of the windows or .net updates that ran that night.
0
 
jrwalker1048Author Commented:
I dug up the answer on my own.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.