Daniel,
If the script works without modification when you install Microsoft .NET 4.5, then wouldn't that be the solution? "Object cannot be loaded 0x80131515" doesn't necessarily (though it could be) sound like a pathing issue to me, even if that's what your online research shows. Cheers, Trevor Sullivan <http://trevorsullivan.net/> <http://twitter.com/pcgeek86> <http://facebook.com/trevor.sullivan> <https://plus.google.com/106658223083457664096> From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Ratliff Sent: Thursday, August 15, 2013 12:01 PM To: [email protected] Subject: [powershell] Anyone ever use MySQL connector? Why is .NET 4.5 a requirement?! I am writing a script to connect out to a MySQL db. I downloaded the latest Connector and extracted MySQL.Data.dll. I was testing on my Win7 x64 box (PoSH 3.0 and .NET 4.5) and I can load the assembly just fine, but any Win7 machine with .NET 4.0 will not load it! I have tried the v2.0, v4.0, and v.4.5 dll to no avail. I also tried using the add-type command as well. The error I get is object cannot be loaded 0x80131515. Anything online I search for says I have the wrong path, but I doubt that is the case because if I install .NET 4.5 the script works without modification! Any ideas? function global:PrinterList { Param( [string]$printerip ) $mysqlserver = "server" $mysqldb = "db" $mysqluser = "user" $mysqlpassword = 'pass' $mysqlconnectionstring = "Server=$mysqlserver; Database=$mysqldb; User=$mysqluser; Password=$mysqlpassword" $mysqlquery = " SELECT Model,IP,Building,Floor,Printer_ID FROM printers WHERE ip = '$printerip'" #[void][System.Reflection.Assembly]::LoadFrom(".\MySql.Data.dll") add-type -Path ".\MySql.Data.dll" $connection = New-Object MySql.Data.MySqlClient.MySqlConnection $connection.ConnectionString = $mysqlconnectionString $connection.Open() $command = New-Object MySql.Data.MySqlClient.MySqlCommand($mysqlquery, $connection) $dataAdapter = New-Object MySql.Data.MySqlClient.MySqlDataAdapter($command) $global:mysqltable = New-Object System.Data.DataTable $recordCount = $dataAdapter.Fill($mysqltable) $global:mysqltable } Daniel Ratliff The information transmitted is intended only for the person or entity to which it is addressed and may contain CONFIDENTIAL material. If you receive this material/information in error, please contact the sender and delete or destroy the material/information. ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1
<<image001.gif>>
<<image002.gif>>
<<image003.gif>>
<<image004.gif>>
