Forum Discussion

ShaneCal_162988's avatar
ShaneCal_162988
Icon for Altocumulus rankAltocumulus
Dec 16, 2014

iControlSnapIn Problems

I'm at the end of my wits here, I've read through all the guides, followed each of them to a word, I've been through several uninstalls and restarts and I'm still nowhere near getting this snapin to work...

 

Without further adieu, here's the complete list of errors I've been getting for the last several hours:

 

Post install:

 

Get-F5.LTMPool : The term 'Get-F5.LTMPool' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or 
    if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + Get-F5.LTMPool
    + ~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Get-F5.LTMPool:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException

I guess I'd better try to add the snap-in again:

 

Add-PSSnapIn : Cannot load Windows PowerShell snap-in iControlSnapIn because of the following error: The Windows PowerShell snap-in module C:\Program Files (x86)\F5 
Networks\iControlSnapIn\iControlSnapin.dll does not have the required Windows PowerShell snap-in strong name iControlSnapIn, Version=11.2.0.0, Culture=neutral, 
PublicKeyToken=null.
At C:\dev\ARM-Tools\Code Snippets\Shane\F5Helper.psm1:9 char:5
+     Add-PSSnapIn iControlSnapIn
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (iControlSnapIn:String) [Add-PSSnapin], PSSnapInException
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

I resolved that by forcing a remove and then an add of the snap-in:

 

Unregistering iControlSnapin.dll on platform ''
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.7905
Copyright (c) Microsoft Corporation.  All rights reserved.

Unregistering iControlSnapin.dll on platform '64'
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.7905
Copyright (c) Microsoft Corporation.  All rights reserved.

Registering iControlSnapin.dll on platform ''
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.7905
Copyright (c) Microsoft Corporation.  All rights reserved.

Registering iControlSnapin.dll on platform '64'
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.7905
Copyright (c) Microsoft Corporation.  All rights reserved.

Another attempt at using one of the cmdlets available through the snap-in:

 

Initialize-F5.iControl : The term 'Initialize-F5.iControl' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling 
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Initialize-F5.iControl
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Initialize-F5.iControl:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Maybe it didn't add the first 2 times, I should try it again:

 

PS C:\program files (x86)\F5 Networks\iControlSnapin> Add-PSSnapIn iControlSnapIn
Add-PSSnapIn : An item with the same key has already been added.
At line:1 char:1
+ Add-PSSnapIn iControlSnapIn
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-PSSnapin], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.AddPSSnapinCommand

Looks like it's already there, I'd better remove it because it's not working:

 

PS C:\program files (x86)\F5 Networks\iControlSnapin> Remove-PSSnapIn iControlSnapIn
Remove-PSSnapIn : No Windows PowerShell snap-ins matching the pattern 'iControlSnapIn' were found. Check the pattern and then try the command again.
At line:1 char:1
+ Remove-PSSnapIn iControlSnapIn
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (iControlSnapIn:String) [Remove-PSSnapin], PSArgumentException
    + FullyQualifiedErrorId : NoPSSnapInsFound,Microsoft.PowerShell.Commands.RemovePSSnapinCommand

So I uninstall and reinstall and follow the guides again, just to get another failure message:

 

Get-F5.LTMPool : The term 'Get-F5.LTMPool' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or 
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-F5.LTMPool
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-F5.LTMPool:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I'm running Windows 8.1, 64-bit, PS v.4. Can anyone help me get this going?

 

  • Thanks to DeniceJ for necromancing this thread, I would have forgotten about it if I didn't get the alert

    Here's the code I've been using for the last few years to register the iControlSnapIn.dll and add the snap-in to the current session

     

    $PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
    $snapinPath = "$PSScriptRoot\f5-icontrol-powershell-snapin-12_1_0\iControlSnapIn.dll"
    $snapinName = "iControlSnapIn"
    
    if (Get-PSSnapIn -name $snapinName -ErrorAction Ignore)
    {
        Write-Output "Verified that '$snapinName' snap-in is currently registered to this session"
    }
    else
    {
        Write-Output "The '$snapinName' snap-in is not currently registered to this session, installing assembly for this snap-in from the following path now:`n$snapinPath"
        $installUtil = "$env:windir\Microsoft.Net\Framework${platform}\v2.0.50727\installUtil.exe";
        if ( [System.IO.File]::Exists($installUtil) )
        {
            Set-Alias installUtil $installUtil;
            installUtil $snapinPath /LogToConsole=false /LogFile=;
        }
        Write-Output "The '$snapinName' snap-in assembly has been registered, adding snap-in to this session now..."
        Add-PSSnapIn $snapinName  Add F5 iControl Library
        Write-Output "The '$snapinName' snap-in has been added to this session, continuing...`n"
    }
    

     

    Note that I store the f5-icontrol-powershell-snapin-12_1_0 folder which contains the iControlSnapIn.dll in my script directory, as the script needs to run from different machines that may not have any F5 software installed.

  • if you run Get-PSSnapin -Registered, does it show the iControlSnapin?

    Then, if you run Get-Command -Module iControlSnapin, do you get anything? And what versions of .NET do you have installed? (You can check with this command and see what folders exist dir "C:\Windows\Microsoft.NET\Framework")

  • This may not matter, but are you using "Run as administrator" when you open PowerShell?

     

    • Michael_Jenkins's avatar
      Michael_Jenkins
      Icon for Cirrostratus rankCirrostratus
      But when you click the Powershell icon, did you try to right-click and select "Run As Administrator"? I've seen instances where Win 8's UAC causes problems with things and even though your account is an admin account, you have to right click the application and "Run As Administrator"
    • ShaneCal_162988's avatar
      ShaneCal_162988
      Icon for Altocumulus rankAltocumulus
      Yes, right-click PowerShell ISE and "Run As Administrator", then enter my admin account details when prompted
  • Shane, sorry for the issues you are having. I've never seen this behavior before. Could you please comment with the output of the following

     

    > (Get-WmiObject -class Win32_OperatingSystem).Caption
    > [System.Environment]::OSVersion
    > $host.version
    > $PSVersionTable
    > Get-PSSnapin -Registered iControlSnapin | select *
    > Remove-PSSnapin iControlSnapin
    > Add-PSSnapin iControlSnapin
    > Get-PSSnapin iControlSnapin | select *
    > Get-Command -Module iControlSnapin
    

     

    If you are getting everything except having a command listing, the it could be that there is an issue with the PowerShell version, the versions of .Net you have on your system and/or an incompatibility with the build of the iControl Snapin. Getting the versions of everything will help on my end...

    -Joe

  • Hi chaps, try including this function and running it before connecting to your load balancer:

     

    function Add-F5Snapin
    {
        $PreviousLocation = Get-Location
    
        if(Test-Path -Path 'C:\Program files (x86)\F5 Networks\iControlSnapin\setupSnapin.ps1')
        {
            Set-Location 'C:\Program files (x86)\F5 Networks\iControlSnapin\'
        }
        elseif(Test-Path -Path 'C:\Program files\F5 Networks\iControlSnapin\setupSnapin.ps1')
        {
            Set-Location 'C:\Program files\F5 Networks\iControlSnapin\'
        }
        else
        {
            throw 'You do not have the iControl Snapin installed.'
        }
    
        .\setupSnapin.ps1 -force
    
        Set-Location $PreviousLocation
    
        if((Get-PSSnapin -Name 'iControlSnapIn' -ErrorAction SilentlyContinue) -eq $null)
        {
            Add-PsSnapin 'iControlSnapIn'
        }
    }
    

     

    @Joe: Please could you start a GitHub repository so the community can contribute and create a modern PowerShell module?

  • I have had the exact same issue on an upgraded from Win7 to Win10 machine and the version 13.0.0.0 of the snapin.

     

    I have beat my head against the wall trying to resolve this issue. It appears to be registered, but I cannot add it or remove it. Nor do any of the cmdlets available.

     

    I have dotNet 4.62 and Powershell 5.1. CLR is 4.0.30319

     

    Did you ever determine a resolution?

     

  • Thanks to DeniceJ for necromancing this thread, I would have forgotten about it if I didn't get the alert

    Here's the code I've been using for the last few years to register the iControlSnapIn.dll and add the snap-in to the current session

     

    $PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
    $snapinPath = "$PSScriptRoot\f5-icontrol-powershell-snapin-12_1_0\iControlSnapIn.dll"
    $snapinName = "iControlSnapIn"
    
    if (Get-PSSnapIn -name $snapinName -ErrorAction Ignore)
    {
        Write-Output "Verified that '$snapinName' snap-in is currently registered to this session"
    }
    else
    {
        Write-Output "The '$snapinName' snap-in is not currently registered to this session, installing assembly for this snap-in from the following path now:`n$snapinPath"
        $installUtil = "$env:windir\Microsoft.Net\Framework${platform}\v2.0.50727\installUtil.exe";
        if ( [System.IO.File]::Exists($installUtil) )
        {
            Set-Alias installUtil $installUtil;
            installUtil $snapinPath /LogToConsole=false /LogFile=;
        }
        Write-Output "The '$snapinName' snap-in assembly has been registered, adding snap-in to this session now..."
        Add-PSSnapIn $snapinName  Add F5 iControl Library
        Write-Output "The '$snapinName' snap-in has been added to this session, continuing...`n"
    }
    

     

    Note that I store the f5-icontrol-powershell-snapin-12_1_0 folder which contains the iControlSnapIn.dll in my script directory, as the script needs to run from different machines that may not have any F5 software installed.

    • DeniceJ_246311's avatar
      DeniceJ_246311
      Icon for Nimbostratus rankNimbostratus

      Thanks, but my issues is that the add-pssnapin doesn't load the file. It gives me a message that it is already loaded.

       

      What is most interesting, is that if I look in the registry at the Powershell Snapins, it is registered w/ a PSVersion of 2.0 rather than 5.1. I can hack the registry to say 5.1 in the display that shows registered snapins. But it still will not load.

       

      I receive the following message

       

      add-pssnapin : An item with the same key has already been added. At line:1 char:1 + add-pssnapin icontrolsnapin + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Add-PSSnapin], ArgumentException + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.AddPSSnapinCommand

       

      However, get-pssnapin -registered shows the module is registered.

       

      PS C:\Program Files\F5 Networks\iControlSnapIn> Get-PSSnapin -Registered

       

      Name : iControlSnapIn PSVersion : 2.0 Description : iControl Snap-in for F5 Device Management

       

      If I try to remove-pssnapin icontrolsnapin, i receive a message that it is not loaded.

       

      remove-pssnapin : No Windows PowerShell snap-ins matching the pattern 'icontrolsnapin' were found. Check the pattern and then try the command again. At line:1 char:1 + remove-pssnapin icontrolsnapin + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (icontrolsnapin:String) [Remove-PSSnapin], PSArgumentException + FullyQualifiedErrorId : NoPSSnapInsFound,Microsoft.PowerShell.Commands.RemovePSSnapinCommand

       

      It seems to me that the old version is being "installed" even though the registry indicates that it is version 13.0.0.0 of the snapin.

       

  • I have the same issue, if I just reopen another powershell shell I am fine.