Forum Discussion

Stephen_02_1454's avatar
Stephen_02_1454
Icon for Nimbostratus rankNimbostratus
Sep 22, 2014

Mass creation and deletes using powershell

I have a couple basic scripts that take arguments from a master workflow that executes them. Out of 20 requests one fails and that is not consistent. I have added logic if I see another delete action from my workflow running, I wait before executing the next one.

 

The script (delete only you get the idea): Add-PSSnapin iControlSnapIn

 

try {

 

$output = initialize-F5.iControl -HostName $F5device -Username $F5username -Password $F5password

 

$output = $(Get-F5.iControl).LocalLBVirtualServer.delete_virtual_server( (,$Name) ); return 1 } catch { return "ERROR:$_"

 

}

 

The script output...

 

ion] initialize-F5.iControl : Could not initialize connection with supplied information At C:\vCOcoreScripts\createF5Pool.ps1:7 char:11 + $output = initialize-F5.iControl -HostName $F5device -Username $F5username -Pas ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ + CategoryInfo : PermissionDenied: (10.40.0.77:String) [Initializ e-F5.iControl], Exception + FullyQualifiedErrorId : 2,iControlSnapIn.CmdLet.Global.InitializeiContro l

 

com.vmware.o11n.plugin.powershell.util.ssh.SSHException: initialize-F5.iControl : Could not initialize connection with supplied information At C:\vCOcoreScripts\createF5Pool.ps1:7 char:11 + $output = initialize-F5.iControl -HostName $F5device -Username $F5username -Pas ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ + CategoryInfo : PermissionDenied: (1.1.1.1:String) [Initializ e-F5.iControl], Exception + FullyQualifiedErrorId : 2,iControlSnapIn.CmdLet.Global.InitializeiContro l

 

2 Replies

  • Looks like its related more to the number of sessions/connections that are being established. Can you do all of this in one session rather than opening one per task?

     

  • I could, but then I would lose the flexibility of re-using the same script for multiple purposes. I wish there was a queue the command would sit in. I use my Orchestration engine to validate each piece and its success factors. Anyway I look at it, I will have to workaround this limitation.

     

    Thank you

     

    -Stephen