开发者

Powershell problem using .NET Replication Management Objects RMO

开发者 https://www.devze.com 2023-04-05 16:13 出处:网络
I am trying to automate the reinitialization of several replication subscriptions that pull anonymously from the distribution server. I am

I am trying to automate the reinitialization of several replication subscriptions that pull anonymously from the distribution server. I am working on this project in Powershell and I believe I am having a 64bit vs 32bit problem with the .NET Replication Management Objects (RMO). I am loading the RMO and Replication assemblies. The RMO assembly loads the MSIL version, but the Replication assembly is only available in either X86 or X64.

The problem that I am having is that the Microsoft.SqlServer.Replication.TransSynchronizationAgent Class is not available when I r开发者_运维技巧un my script on a 64bit machine. When I run it on a 32bit machine it works fine.

When I try to create a new-object of that Class on a 64bit machine, I get an error that the Class is not registered. I looked in the registry and the Class is registered with the GAC in both 64bit and 32bit(Wow6432Node) locations.

Has anyone ever experienced this issue before? Any ideas on a fix?

Thank you, Rickey


I ran into a similar x64 vs x32 bit issue with Powershell recently. Its related to Windows Filesystem Redirection (more info here: http://practicaladmin.wordpress.com/2010/07/16/powershell-x64-and-filesystem-redirection/)

If you try to instantiate a 64bit Powershell instance from within a 32bit memory space (32bit PID or a PID running in 32bit mode/etc), Windows tries to "do the right thing" and executes the 32bit version of Powershell (in the syswow64 folder - yes, the 32bit powershell lives in the syswow64 folder).

Try running the 64bit version of Powershell.exe explicitly on the 64bit box using the following path:

%windir%\sysnative\WindowsPowerShell\v1.0\powershell.exe
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号