VMware Horizon Community
casperinmd
Enthusiast
Enthusiast
Jump to solution

GetApname not valid on View AG deployment

When I run this script (Using PowerShell to Deploy VMware Unified Access Gateway (formerly known as Access Point) ) , I get the error: GetAPName : The term 'GetAPName' is not recognized as the name of a cmdlet,

get-apname doesnt' work either (figured maybe a typo). Where does this command come from?

I'm running this from PowerCLI 6.5, and have the OVF deploy tool msi installed as well.

0 Kudos
1 Solution

Accepted Solutions
markbenson
VMware Employee
VMware Employee
Jump to solution

OK. So change the .ini file so that it instead reads:

[General]

#

# UAG virtual appliance unique name (between 1 and 32 characters).

# If name is not specified, the script will prompt for it.

#

name=ap1

(here ap1 is just an example of the name you want for your appliance).

You can also download the latest .zip file apdeploy script and that allows you to leave out the name specification and it will prompt for it instead (i.e. if you delete the whole name=ap1 line). My advice though is to have it in the .ini file so that you don't have to enter it each time you run the script. Each time, you run apdeploy.ps1, it will replace any existing appliance of that same name. This is useful when you change settings or upgrade/downgrade the .ova image.

The GetAPName issue you had was with the combination of using an older apdeploy.ps1 script (not the latest UAG 2.9 version) and not specifying the name=xxx line in the .ini file. Hopefully you are passed that issue now.

Use the example .ini files to start with as they are all valid examples. You can then just change the values for your own environment.

View solution in original post

10 Replies
casperinmd
Enthusiast
Enthusiast
Jump to solution

So I simply hard coded the APname in teh script as I did nto see where it was trying to call a function. I'll leave this here in case others have the issue.

0 Kudos
markbenson
VMware Employee
VMware Employee
Jump to solution

casperinmd I think it is because you are missing the "name=" setting in your .ini file.

Change the script back to how it was and add the "name=" line in the .ini file (as shown in the sample .ini files). e.g.

[General]

name=AP1

...

This is the name of the VM.

Let us know if this resolves it.

0 Kudos
casperinmd
Enthusiast
Enthusiast
Jump to solution

Hi Mark, thanks for the reply.

So, it seems the default ini's have: name= (not wrapped in "") in them. However, that never works for me. I get this error:

GetAPName : The term 'GetAPName' 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 C:\tmp\AG Deploy\apdeploy.ps1:183 char:12

+     $apName = GetAPName

+               ~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (GetAPName:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

GetRootPwd : Cannot bind argument to parameter 'apName' because it is null.

At C:\tmp\AG Deploy\apdeploy.ps1:187 char:27

+     $rootPwd = GetRootPwd $apName

+                           ~~~~~~~

    + CategoryInfo          : InvalidData: (:) [GetRootPwd], ParameterBindingValidationException

    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,GetRootPwd

GetAdminPwd : Cannot bind argument to parameter 'apName' because it is null.

At C:\tmp\AG Deploy\apdeploy.ps1:191 char:29

+     $adminPwd = GetAdminPwd $apName

+                             ~~~~~~~

    + CategoryInfo          : InvalidData: (:) [GetAdminPwd], ParameterBindingValidationException

    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,GetAdminPwd

I followed your comment exactly as you stated in your reply and put: "name=" (in it and works, note the variable in " ")

0 Kudos
markbenson
VMware Employee
VMware Employee
Jump to solution

casperinmd - Can you paste the start of the .ini file so that we can see it. Others are not seeing this so I'm curious to find out what this issue is.

Check also that you are using the latest apdeploy.ps1 and apdeploy.psm1 from the zip downloaded from the PowerShell doc.

Thanks.

0 Kudos
casperinmd
Enthusiast
Enthusiast
Jump to solution

markbenson

I am using apdeploy-290-v2

Here is the INI I am using that fails.

[General]

#

# UAG virtual appliance unique name (between 1 and 32 characters).

# If name is not specified, the script will prompt for it.

#

name=

Also, not sure what I did initially with "Name=" but that now prompts for datastore name. So it is not asking for the VM name. Regardless, the command fails when not using a hard set name where the script says I can choose to not specify. For me this is now a moot point as I don't use DHCP and so I need to edit the rest of the script to hard code the IPA's anyway for each gateway. However, happy to assist in seeing why it won't work if you care to figure it out! Maybe I am just the anomaly.

0 Kudos
pchapman
Hot Shot
Hot Shot
Jump to solution

I think you need to take a step back and re-read the instructions for the script.  You do not need to edit the script to assign a static IP address. You should never need to edit the actual script.  I've been using this script for the last 5-6 revisions, for various clients with various different configs and have never had a problem.  Use one of the sample INI's (such as basic) and edit from there!

0 Kudos
casperinmd
Enthusiast
Enthusiast
Jump to solution

I am not editing the script, sorry to not be clear. I am editing the INI file  which is there to be edited. Do you leave the ini with a blank name field and IPA fields?

0 Kudos
markbenson
VMware Employee
VMware Employee
Jump to solution

OK. So change the .ini file so that it instead reads:

[General]

#

# UAG virtual appliance unique name (between 1 and 32 characters).

# If name is not specified, the script will prompt for it.

#

name=ap1

(here ap1 is just an example of the name you want for your appliance).

You can also download the latest .zip file apdeploy script and that allows you to leave out the name specification and it will prompt for it instead (i.e. if you delete the whole name=ap1 line). My advice though is to have it in the .ini file so that you don't have to enter it each time you run the script. Each time, you run apdeploy.ps1, it will replace any existing appliance of that same name. This is useful when you change settings or upgrade/downgrade the .ova image.

The GetAPName issue you had was with the combination of using an older apdeploy.ps1 script (not the latest UAG 2.9 version) and not specifying the name=xxx line in the .ini file. Hopefully you are passed that issue now.

Use the example .ini files to start with as they are all valid examples. You can then just change the values for your own environment.

casperinmd
Enthusiast
Enthusiast
Jump to solution

Thanks Mark.

I just got the v2 a week ago, but just grabbed the v3 and commented out the "name=" to test, and it did prompt.

On v2, if I put the name of the VM in there without "" it worked, I thought to get it to prompt, you left the variable empty like: name=

So that was my not understanding the comment well enough.

Thanks for the replies and getting it setup. I also see what you mean by having an ini for each one, so it makes upgrades/redeploy very very fast. I'll go that route!

Appreciate your scripts and willingness to help me see what I was doing wrong.

0 Kudos
markbenson
VMware Employee
VMware Employee
Jump to solution

No problem. Glad it's resolved and thanks for posting your findings.

0 Kudos