Solved

Script for account creation fails after SP3 RU4

Posted on 2014-02-20
5
361 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
In this video we show how to create an Address List in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Organization >> Ad…
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…

690 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