Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, November 17, 2010 12:07 AM
Hello,
I am trying to integration my c# web service with my powershell scripts. When I try to call the scripts from the service, I get an exception that it cannot file the SystemManagement.Automation.dll. I have using Windows 2003 server and have installed .NET 3.5 sp1 and powershell 2.
What do I need to do to get around past this.
Thanks
System.IO.FileNotFoundException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>C:\WINDOWS\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35\System.Management.Automation.dll
ostics.ActivityBoundary.aspx</TraceIdentifier><Description>Activity boundary.</Description><AppDomain>/LM/W3SVC/1/Root/ServiceHost-1-129344247869531250</AppDomain><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"><ActivityName>Execute 'WcfIdentityServiceLibrary.ConnectorService.add'.</ActivityName><ActivityType>ExecuteUserCode</ActivityType></ExtendedData></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>0</EventID><Type>3</Type><SubType Name="Transfer">0</SubType><Level>255</Level><TimeCreated SystemTime="2010-11-16T23:46:27.6250000Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{843331b0-dfac-4a29-b015-54992e2f4a51}" RelatedActivityID="{ee0aab94-a7e9-4f17-8939-b79b73808250}" /><Execution ProcessName="w3wp" ProcessID="4596" ThreadID="5" /><Channel/><Computer>WIN2003</Computer></System><ApplicationData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>131085</EventID><Type>3</Type><SubType Name="Stop">0</SubType><Level>255</Level><TimeCreated SystemTime="2010-11-16T23:46:27.6250000Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{843331b0-dfac-4a29-b015-54992e2f4a51}" /><Execution ProcessName="w3wp" ProcessID="4596" ThreadID="5" /><Channel/><Computer>WIN2003</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Stop"><TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx</TraceIdentifier><Description>Activity boundary.</Description><AppDomain>/LM/W3SVC/1/Root/ServiceHost-1-129344247869531250</AppDomain><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"><ActivityName>Execute 'WcfIdentityServiceLibrary.ConnectorService.add'.</ActivityName><ActivityType>ExecuteUserCode</ActivityType></ExtendedData></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>131085</EventID><Type>3</Type><SubType Name="Resume">0</SubType><Level>255</Level><TimeCreated SystemTime="2010-11-16T23:46:27.6250000Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{ee0aab94-a7e9-4f17-8939-b79b73808250}" /><Execution ProcessName="w3wp" ProcessID="4596" ThreadID="5" /><Channel/><Computer>WIN2003</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Resume"><TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx</TraceIdentifier><Description>Activity boundary.</Description><AppDomain>/LM/W3SVC/1/Root/ServiceHost-1-129344247869531250</AppDomain><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"><ActivityName>Process action 'http://www.openiam.org/service/connector/ConnectorService/add'.</ActivityName><ActivityType>ProcessAction</ActivityType></ExtendedData></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>131076</EventID><Type>3</Type><SubType Name="Error">0</SubType><Level>2</Level><TimeCreated SystemTime="2010-11-16T23:46:27.6250000Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{ee0aab94-a7e9-4f17-8939-b79b73808250}" /><Execution ProcessName="w3wp" ProcessID="4596" ThreadID="5" /><Channel/><Computer>WIN2003</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error"><TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.TraceHandledException.aspx</TraceIdentifier><Description>Handling an exception.</Description><AppDomain>/LM/W3SVC/1/Root/ServiceHost-1-129344247869531250</AppDomain><Exception><ExceptionType>System.IO.FileNotFoundException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>C:\WINDOWS\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35\System.Management.Automation.dll</Message><StackTrace> at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
at System.Management.Automation.PSVersionInfo.GetPSVersionTable()
at System.Management.Automation.PSVersionInfo.get_PSVersion()
at Microsoft.PowerShell.DefaultHost..ctor(CultureInfo currentCulture, CultureInfo currentUICulture)
at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace()
at WcfIdentityServiceLibrary.ActiveDirectoryConnector.add(add1 request)
at SyncInvokeadd(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><ExceptionString>System.IO.FileNotFoundException: C:\WINDOWS\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35\System.Management.Automation.dll
at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
at System.Management.Automation.PSVersionInfo.GetPSVersionTable()
at System.Management.Automation.PSVersionInfo.get_PSVersion()
at Microsoft.PowerShell.DefaultHost..ctor(CultureInfo currentCulture, CultureInfo currentUICulture)
at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace()
at WcfIdentityServiceLibrary.ActiveDirectoryConnector.add(add1 request)
All replies (8)
Wednesday, November 17, 2010 3:30 PM ✅Answered | 3 votes
System.Management.Automation.dll is installed by PowerShell into the GAC (there is no copy outside of the GAC, unlikely the .NET Framework assemblies). NB. the .NET 1/1.1/2 GAC has an Explorer extension, you need to use a command or PowerShell prompt to search it (.NET 4 has a different GAC without an Explorer extension, but PowerShell 2 is based on .NET 2 CLR..
If you install the Windows SDK a reference copy is placed in C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0.
I would suggest first looking at your assembly that runs the scripts (i.e. where you reference PowerShell types like Runspace) with ildasm.exe or .NET Reflector to check exactly what System.Management.Automation.dll assembly you are referencing.
If this reference is OK, then make use of the Assembly Binding Log Viewer (Fuslogvw.exe) to see where the .NET loader is trying to load System.Management.Automation.dll.
Richard J Cox
Wednesday, November 17, 2010 6:10 PM ✅Answered
well it looks like that would solve your problem. also there is a difference between adding from the GAC and adding a DLL reference. it seems (Based on your search results) that its in the GAC but the dll doesn’t appear as with the SDK installed. trying adding a .NET reference rather than the DLL reference.
other than that, yeah the SDK install should do it.
Wednesday, November 17, 2010 12:56 PM
well it shows you how its trying to reference it. is that the correct path? if so I'd start to look at security and make sure how ever you have IIS setup (app pool) that the account has access to that.
Wednesday, November 17, 2010 2:02 PM
I did a search across the drive and cant find any System.Management.Automation.dll.
I did fine a System.management.automation properties file in the C:\WINDOWS\assembly
I have installed .net 3.5. Is there something else that I need to install to get this in place?
thanks
Wednesday, November 17, 2010 4:18 PM
how did you add the reference in to your app?
Wednesday, November 17, 2010 6:02 PM
This may be the root of my problem. I have two environments. I have a windows 7 where I use visual studio 2008. On this, I had installed the windows SDK and its has the system.management dll and I added the reference to my project.
I am running this on a 2003 server. On this, I did not add the windows sdk. Do I need to install it here as well?
thanks
Wednesday, November 17, 2010 6:15 PM
Thanks for all your help. Really appreciate it.
This is a bit new for me
Sunday, October 5, 2014 11:16 AM
This is my answer: System.Management.Automation 6.1.7601.17515'. You are trying to install this package into a project that targets '.NETFramework,Version=v3.5' but the package does not contain any assembly references or content files that are compatible with that framework.