Forum Discussion
Piers_72246
Oct 24, 2012Nimbostratus
Snap-in installed but cmdlets not visible
So I have the snapin installed and have a script that starts off with this code, straight from examples here
if ( (Get-PSSnapin | Where-Object { $_.Name -eq "iControlSnapIn"}) -e...
Piers_72246
Oct 26, 2012Nimbostratus
Sorry, I wasn't clear.
The installation and registration of the snap-in works. As does my script (it removes nodes from a pool during code deployment), however the script only works the first time. Here's what happens
I open the myscript.ps1 in powershell ISE and run it. It h runs through the code block in my first post:
if ( (Get-PSSnapin | Where-Object { $_.Name -eq "iControlSnapIn"}) -eq $null ) { Add-PSSnapIn iControlSnapIn } $success = Initialize-F5.iControl -HostName $bigip -Username $user -Password $pass
and, doesn't find the snap in so it runs the Add-PSSnapIn command returns success and goes on to execute the remainder of the script.
If I then run this command, I see that the snap-in is present in my current runtime
PS C:\Windows\system32> Get-PSSnapin | Where-Object { $_.Name -eq "iControlSnapIn"} Name : iControlSnapIn PSVersion : 2.0 Description : iControl Snap-in for F5 Device Management
However calling an F5 specific cmdlet after that doesn't work after that. Example:
PS C:\Windows\system32> Get-Command -Module iControlSnapin Initialize-F5.iControl Get-Command : 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:12 + Get-Command <<<< -Module iControlSnapin Initialize-F5.iControl + CategoryInfo : ObjectNotFound: (Initialize-F5.iControl:String) [Get-Command], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
Subsequent runs of my script also fail after this because of it's dependacy on F5 cmdlets
edit: forum styling grrrrrrrr
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects