Forum Discussion
LocalLB Virtual Server Creation using powershell
Hi There, I am facing issue while trying to create a Virtual Server using powershell.
Code:
$vipdefinition = New-Object -TypeName iControl.CommonVirtualServerDefinition;
$vipdefinition.name = "rajtest.http.vip";
$vipdefinition.address = "172.31.51.14";
$vipdefinition.port = 80;
$vipdefinition.protocol = "PROTOCOL_TCP";
$wildmasks = "255.255.254.0";
$resource = New-Object -TypeName iControl.LocalLBVirtualServerVirtualServerResource;
$resource.type = "RESOURCE_TYPE_POOL";
$resource.default_pool_name = "raj-qa-14_pool";
$profile = New-Object -TypeName iControl.LocalLBVirtualServerVirtualServerProfile;
$profile.profile_context = "PROFILE_CONTEXT_TYPE_ALL";
$profile.profile_name = "http";
(Get-F5.iControl).LocalLBVirtualServer.create($vipdefinition,$wildmask,$resource,$profile);
Error:
Exception calling "create" with "4" argument(s): "Exception caught in LocalLB::urn:iControl:LocalLB/VirtualServer::create()
Exception: Common::OperationFailed primary_error_code : 17236808 (0x01070348) secondary_error_code : 0 error_string : 01070348:3: Virtual Server /Common/rajtest.http.vip destination 172.31.51.14 and netmask 0.0.0.0 are not valid."
At line:1 char:1 + (Get-F5.iControl).LocalLBVirtualServer.create($vipdefinition,$wildmask,$resource ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : SoapHeaderException
Please share if any body faced this kind of issue or have a solution.
Note: I tried all the possible wildmasks value but nothing is working.
However, if if give the destination address and wildmask values as "0.0.0.0", then the VIP is getting created successfully. And from GUI, i am able to edit this and update the destination address to correct value. But want all this to happen in one flow.
3 Replies
Your variable is "$wilmasks" but are passing through it as "$wildmask".
$wildmasks = "255.255.254.0"; (Get-F5.iControl).LocalLBVirtualServer.create($vipdefinition,$wildmask,$resource,$profile);That could explain a potential problem.
-Joe
- Rajkumar_Rajpur
Nimbostratus
Ahhhh...this is really frustrating for me. A silly spelling mistake.
Thanks a lot Joe for your quick help. And yes, that was that was the issue indeed!!
-Rajkumar.
BTW, "Set-PSDebug -strict" can be your friend when dealing with undefined variables.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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