Powershell-PostExploitation icon indicating copy to clipboard operation
Powershell-PostExploitation copied to clipboard

Not work on MSSQL 2012

Open jackpit110 opened this issue 6 years ago • 7 comments

I got this error for master.mdf from SQL Server 2012

New-Object : Cannot find type [OrcaMDF.RawCore.RawDataFile]: make sure the assembly containing this type is loaded.
At C:\Users\Admin\Desktop\Powershell-PostExploitation-master\Invoke-MDFHashes\Get-MDFHashes.ps1:18 char:27
+     $instance = New-Object <<<<  "OrcaMDF.RawCore.RawDataFile" $mdf
    + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

Unable to find type [OrcaMDF.RawCore.Types.RawType]: make sure that the assembly containing this type is loaded.
At C:\Users\Admin\Desktop\Powershell-PostExploitation-master\Invoke-MDFHashes\Get-MDFHashes.ps1:22 char:48
+     $model = @( [OrcaMDF.RawCore.Types.RawType] <<<< ::Int("id"),
    + CategoryInfo          : InvalidOperation: (OrcaMDF.RawCore.Types.RawType:String) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

jackpit110 avatar May 25 '18 00:05 jackpit110

ANY UPDATE ON THIS?

de-adshot avatar May 30 '20 09:05 de-adshot

Problem seems to be in grabbing the path information when loading the libraries Changing: [Reflection.Assembly]::LoadFile($currentLocation.Path + "\\OrcaMDF.RawCore.dll") | Out-Null [Reflection.Assembly]::LoadFile($currentLocation.Path + "\\OrcaMDF.Framework.dll") | Out-NUll To: [Reflection.Assembly]::LoadFile($PSScriptRoot + "\\OrcaMDF.RawCore.dll") | Out-Null [Reflection.Assembly]::LoadFile($PSScriptRoot + "\\OrcaMDF.Framework.dll") | Out-NUll Worked for me

LMS57 avatar Jun 04 '20 16:06 LMS57

If that does not work replace: [Reflection.Assembly]::LoadFile($PSScriptRoot + "\\OrcaMDF.RawCore.dll") [Reflection.Assembly]::LoadFile($PSScriptRoot + "\\OrcaMDF.Framework.dll") To: Add-Type -AssemblyName .\OrcaMDF.RawCore.dll Add-Type -AssemblyName .\OrcaMDF.Framework.dll

humurabbi avatar Jul 09 '20 12:07 humurabbi

If that does not work replace: [Reflection.Assembly]::LoadFile($PSScriptRoot + "\\OrcaMDF.RawCore.dll") [Reflection.Assembly]::LoadFile($PSScriptRoot + "\\OrcaMDF.Framework.dll") To: Add-Type -AssemblyName .\OrcaMDF.RawCore.dll Add-Type -AssemblyName .\OrcaMDF.Framework.dll

I have tested both the solutions suggested by humurabbi & LMS57. humurabbi's solution works when using powershell in linux while LMS57's solution works only in windows's powershell.

mansoorr123 avatar Jul 13 '20 10:07 mansoorr123

For those still having issues

[System.Reflection.Assembly]::UnsafeLoadFrom($PSScriptRoot + "\OrcaMDF.RawCore.dll") | Out-Null [System.Reflection.Assembly]::UnsafeLoadFrom($PSScriptRoot + "\OrcaMDF.Framework.dll") | Out-NUll

dvs17 avatar Jul 18 '20 23:07 dvs17

If you're still having issues after editing the script, make sure that you have unblocked the dlls (right click -> properties).

0xceba avatar Oct 15 '20 18:10 0xceba

And if you're still having issues with all of the above (which I was) try the following (worked for me):

[System.Reflection.Assembly]::UnsafeLoadFrom("C:\\Users\\admin\\Desktop\\MDF\\OrcaMDF.RawCore.dll") | Out-Null [System.Reflection.Assembly]::UnsafeLoadFrom("C:\\Users\\admin\\Desktop\\MDF\\OrcaMDF.Framework.dll") | Out-Null

Winstonw0lf avatar Jun 02 '22 08:06 Winstonw0lf