Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test-NetConnection is not valid for Powershell 7 #84

Closed
4 tasks done
burnsjared0415 opened this issue Jan 16, 2024 · 7 comments · Fixed by #85
Closed
4 tasks done

Test-NetConnection is not valid for Powershell 7 #84

burnsjared0415 opened this issue Jan 16, 2024 · 7 comments · Fixed by #85
Assignees
Labels
bug Bug
Milestone

Comments

@burnsjared0415
Copy link
Contributor

Code of Conduct

  • I have read and agree to the Code of Conduct.
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

VMware Cloud Foundation

5.0.0.0

PowerShell Version

Core Powershell 7.3.11

PowerCLI Version

13.2.1.22851661

Module Version

lastest

PowerVCF Version

2.4.1.1000

Guest Operating System

Mac

Environment Details

Environment is a VCF 5.0.0 with one Management Domain and VI domain

Description

Code is using Test-NetConnection in multiple Functions and if a customer uses Core Powershell not Desktop, customer will get errors around connection to vCenter or NSX not able to connect. This will cause errors like:
ERROR Connection to 'XXXXXX' has failed. Check your environment and try again
[01-16-2024_17:36:20] ERROR at Script Line 148
[01-16-2024_17:36:20] Relevant Command: Write-PowerManagementLogMessage -Type ERROR -Message "Connection to '$server' has failed. Check your environment and try again" -Colour Red
[01-16-2024_17:36:20] ERROR Message: Connection to 'XXXXXXXX' has failed. Check your environment and try again

Need to update code to check Desktop vs Core on Powershell

Error or Debug Output

ERROR Connection to 'XXXXXX' has failed. Check your environment and try again
[01-16-2024_17:36:20] ERROR at Script Line 148
[01-16-2024_17:36:20] Relevant Command: Write-PowerManagementLogMessage -Type ERROR -Message "Connection to '$server' has failed. Check your environment and try again" -Colour Red
[01-16-2024_17:36:20] ERROR Message: Connection to 'XXXXXXXX' has failed. Check your environment and try again

Expected Behavior

INFO Connecting to 'jbvcfmgtvc01.vsanpe.vmware.com'...
[01-16-2024_17:46:12] INFO Connected to server 'XXXXXXX' and attempting to shut down nodes 'XXXX'...

Actual Behavior

ERROR Connection to 'XXXXXX' has failed. Check your environment and try again
[01-16-2024_17:36:20] ERROR at Script Line 148
[01-16-2024_17:36:20] Relevant Command: Write-PowerManagementLogMessage -Type ERROR -Message "Connection to '$server' has failed. Check your environment and try again" -Colour Red
[01-16-2024_17:36:20] ERROR Message: Connection to 'XXXXXXXX' has failed. Check your environment and try again

Steps to Reproduce

Run any of the functions that on Test-NetConnection in a IF statement with a Core Install of Powershell

Log Fragments and Files

No response

Screenshots

No response

References

No response

@burnsjared0415 burnsjared0415 added bug Bug needs-triage Needs Triage labels Jan 16, 2024
@github-actions github-actions bot added the pending-review Pending Review label Jan 16, 2024
@burnsjared0415 burnsjared0415 changed the title Please add a short description. Bug: Test-NetConnection is only good with Desktop Powershell not Core Jan 16, 2024
@tenthirtyam
Copy link
Collaborator

We have some code in another module that will correct this issue.

@burnsjared0415
Copy link
Contributor Author

I thought we did, just did not want to make the change with out approval

@tenthirtyam
Copy link
Collaborator

Take a look at Test-EndpointConnection from PVS - we might be able to use much of the same but not require PVS for this module as a dependency.

@burnsjared0415
Copy link
Contributor Author

burnsjared0415 commented Jan 17, 2024

could we add the Test-EndpointConnection to PowerManagement and just update all Test-NetConnections to Test-EndpointConnection? we can make the Function not Export

@tenthirtyam
Copy link
Collaborator

Yea, as long as the scripts do not use it directly.

burnsjared0415 added a commit to burnsjared0415/powershell-module-for-vmware-cloud-foundation-power-management that referenced this issue Jan 17, 2024
Test-NetConnection is only supported for Powershell Desktop not Core, I have updated the Test-NetConnection to be Test-EndpointConnection. Updated all documentation to add PowerValidatedSolutions as a module

Signed-off-by: Jared Burns <[email protected]>
@burnsjared0415
Copy link
Contributor Author

Push with change from Test-NetConnection to Test-Endpoint Complete

@tenthirtyam tenthirtyam reopened this Jan 17, 2024
@tenthirtyam tenthirtyam changed the title Bug: Test-NetConnection is only good with Desktop Powershell not Core Test-NetConnection is not valid for Powershell 7 Jan 17, 2024
@tenthirtyam tenthirtyam removed needs-triage Needs Triage pending-review Pending Review labels Jan 17, 2024
@tenthirtyam tenthirtyam added this to the v1.5.0 milestone Jan 17, 2024
Copy link

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug
Projects
None yet
2 participants