Quantcast
Viewing all articles
Browse latest Browse all 15889

add-type -assemblyName System.IO.Stream is failing in powershell script

Hi all,

I am trying to do some automation using powershell scripting. I have following code in my script:

add-type -assemblyName System.IO.Stream

I also have this: 

add-type -assemblyName System
add-type -assemblyName System.ServiceModel

later 2 work fine but I am getting below error for System.IO.Stream

Add-Type : Cannot add type. One or more required assemblies are missing.
At D:\XXXX\XX.ps1:14 char:9
+ add-type <<<<  -assemblyName System.IO.Stream
    + CategoryInfo          : InvalidData: (:) [Add-Type], InvalidOperationException
    + FullyQualifiedErrorId : ASSEMBLY_LOAD_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand

ans when i try to use assembly in following way : 

$repairData.RepairedResource= New-Object System.IO.Stream.Null 

I am getting following error: 

Failure in Repairing 03390321-0000-0000-0000-008cfa013036 which is OutForRepair System.Management.Automation.PSArgumentException: Cannot find type [System.IO.Stream.Null]: make sure the assembly containing this type is loaded.
   at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)

Can somebody please help me with this error? 


Performance tester


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>