VMware Networking Community
thompsoa
Enthusiast
Enthusiast
Jump to solution

NSX As-Built script | Cannot connect to NSX Manager

Hi All,

Trying to run the following command. but I'm not connecting to NSX Manager:

PS C:>New-AsBuiltReport -Report VMware.NSXv -Target vc01 -Credential (Get-Credential) -Format HTML,Word -OutputPath C:\Scripts

Using existing PowerCLI connection to VCenterXX

Error


Invoke-AsBuiltReport.VMware.NSXv : Connection to NSX server 172.X.X.X failed : Invoke-NsxRestMethod : The NSX API
response received indicates a failure. 503 : Service Unavailable : Response Body:
At C:\Program Files\WindowsPowerShell\Modules\AsBuiltReport.Core\1.0.1\Src\Public\New-AsBuiltReport.ps1:307 char:13

  •         & "Invoke-$($ReportModule)" -Target $Target -Credential $ ... 
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-AsBuiltReport.VMware.NSXv
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    • CategoryInfo : ObjectNotFound: (NSXManager:String) [Clear-Variable], ItemNotFoundException
    • FullyQualifiedErrorId : VariableNotFound,Microsoft.PowerShell.Commands.ClearVariableCommand

VERBOSE: [ 12:41:55:219 ] [ Document ] - Document 'VMware NSXv As Built Report' processing completed.
VERBOSE: [ 12:41:55:221 ] [ Document ] - Total processing time '59.93' seconds.
VMware NSXv As Built Report has been saved to c:\temp

Screen Shot 2019-06-12 at 12.43.44 PM.png

I've tested the credentials not using PowerNSX and no issue. The account is Enterprise Administrator

Alicia Thompson www.bakingclouds.com Twitter:@bakingclouds
Tags (2)
1 Solution

Accepted Solutions
thompsoa
Enthusiast
Enthusiast
Jump to solution

After digging for a while it's finally working. My problem was  powershell proxy settings

pastedImage_0.png

I changed the setting of the proxy configuration to ‘no proxy’ in PowerShell with the below command I was able to connect and run the script with no problems.


Set-PowerCliConfiguration -proxypolicy noproxy

pastedImage_2.png

Alicia Thompson www.bakingclouds.com Twitter:@bakingclouds

View solution in original post

6 Replies
Marcin4
Enthusiast
Enthusiast
Jump to solution

Hello,

First of all, verify that you got all modules:

Open a Windows PowerShell terminal window and install each of the required modules as follows;

PS C:\> install-module PScribo  
PS C:\> install-module VMware.PowerCLI 
PS C:\> install-module PowerNSX

Then please try to do as follow:

1. Run PowerShell with Administrator Privilages

2. Run command: New-AsBuiltReport -Report VMware.NSXv -Target [vCenter IP] -Credential (Get-Credential) -Format HTML,Word -OutputPath C:\Scripts

3. Enter your vCenter credintionals, it would be best to use administrator@vsphere.local

Best Regards
Marcin Gwóźdź
VCP-NV 6, VCIX-DCV 7, VCIX-DTM 7.
linkedin.com/in/marcin-gwóźdź-80b84b122
0 Kudos
thompsoa
Enthusiast
Enthusiast
Jump to solution

Hi Marcin,

I've followed all the steps mentioned in your post and the problem persist. I get the same error message

Thanks

Alicia Thompson www.bakingclouds.com Twitter:@bakingclouds
0 Kudos
Marcin4
Enthusiast
Enthusiast
Jump to solution

Hmm,

Are you able to do the report from vsphere, try the follow:

New-AsBuiltReport -Report VMware.vSphere -Target [vCenter IP] -Credential (Get-Credential) -Format HTML,Word -OutputPath 'C:\Scripts\' -TimeStamp -EnableHealthcheck

Best Regards
Marcin Gwóźdź
VCP-NV 6, VCIX-DCV 7, VCIX-DTM 7.
linkedin.com/in/marcin-gwóźdź-80b84b122
0 Kudos
thompsoa
Enthusiast
Enthusiast
Jump to solution

vSphere report works fine. No errors like the ones I see running 'VMware.NSXv':-(

Thanks

Alicia Thompson www.bakingclouds.com Twitter:@bakingclouds
0 Kudos
Marcin4
Enthusiast
Enthusiast
Jump to solution

What is your NSX version?

Have you tried to reboot NSX Manger ?

Best Regards
Marcin Gwóźdź
VCP-NV 6, VCIX-DCV 7, VCIX-DTM 7.
linkedin.com/in/marcin-gwóźdź-80b84b122
0 Kudos
thompsoa
Enthusiast
Enthusiast
Jump to solution

After digging for a while it's finally working. My problem was  powershell proxy settings

pastedImage_0.png

I changed the setting of the proxy configuration to ‘no proxy’ in PowerShell with the below command I was able to connect and run the script with no problems.


Set-PowerCliConfiguration -proxypolicy noproxy

pastedImage_2.png

Alicia Thompson www.bakingclouds.com Twitter:@bakingclouds