Forum Discussion

Redwan_120774's avatar
Redwan_120774
Icon for Nimbostratus rankNimbostratus
May 28, 2013

Powershell iControlSnapIn Initialization Problem

Hi,

 

I am trying to use iControlSnapIn for a PowerShell project. Everthing works fine when I use the iControl Installer (.msi) to install and register iControlSnapIn files. However, this process is using the InstallUtil.exe installer from the Microsoft.NET framework and I am looking for an alternative way that will not use any installers at all. I have the two files iControl.dll and iControlSnapIn.dll in a folder and I would like to use them as an import into my powershell script file.

 

Is there a way to use iControlSnapIn without having to install anything and by just importing the required .dll files ?

 

 

Thank you.

 

4 Replies

  • Sure you can. The install doesn't do anything aside from putting the files into the Program files directory. If you just want to copy the files manually to another system you can do that. You will still have to run the SetupSnapin.ps1 file though as the appropriate installUtil.exe needs to be run to register the PowerShell module and cmdlets so you can load them into your runspace.

     

     

    -Joe
  • Hi Joe,

     

    Thank you so much for your response. So,are you saying that its impossible to use the iControlSnapIn without running the InstallUtil.exe ? I was trying to find a way around without using the InstallUtil.exe at all.

     

    waiting for your response.............

     

     

    Thanks.

     

  • You could do a system reflection load ([System.Reflection.Assembly]::LoadFile(path_to_icontrol_dll); on the iControl.dll but that will only give you the raw .Net methods, not the cmdlet integration into the PowerShell runtime. If you want to go that route, you definitely could, you would just have to use the "new-object" cmdlet to get a iControl.Interfaces object and then call the initialize methods on that directly - essentially the same way you would with importing the iControl.dll into a Visual Studio project. In this case, the iControlSnapin.dll wouldn't be needed.

     

     

    -Joe