Sample Exchange

 View Only

Get Non-ASCII Characters 

Oct 07, 2020 09:18 PM

This is a simple PowerCLI script that connects to a vCenter, checks the following for non-ASCII characters in their names, and then creates a text file on the desktop with the results.

  • VMs
  • Networks 
  • Folders
  • Datacenters
  • Clusters
  • Resource Pools
  • Datastores

 

Additional  Notes

  • vCenter read-only credentials are adequate
    • The script will prompt the user for vCenter FQDN/IP and credentials automatically unless the user has saved credentials for the specified vCenter in the PowerCLI Credential Store, in which case the script will use those credentials automatically to connect
    • If the script fails to connect to the specified vCenter, it should throw an error with additional details such as it being unable to resolve the hostname or the credentials being incorrect. It will then prompt the user to try entering the FQDN/IP and credentials again until a connection is successful.
  • Using the latest stable version of PowerShell and PowerCLI is recommended, although earlier versions should theoretically work.
    • The script has been tested using PowerShell 7 (cross-platform PowerShell that can run on Windows, MacOS, or Linux), PowerShell 5.1 (built into Windows), and IDEs such as PowerShell ISE (built into Windows) and VSCode (with the PowerShell extension).
  • The user should verify that the VMware.PowerCLI module is installed on their machine before running the script.
    • Ideally, the user should update to the latest version from the official PowerShell Gallery and remove any old versions of the module that were installed from other sources
    • Installation and updating the module should be trivial using the Install-Module and Update-Module cmdlets
      • Install-Module -Name VMware.PowerCLI (Only needed if the PowerCLI is NOT already installed)
      • Update-Module -Name *VMware* (Not needed if you just installed PowerCLI using “Install-Module”)
  • By default, the report will be placed on the user’s desktop as a .txt file
    • If the user has a “redirected” desktop such as a virtual OneDrive desktop, the script should detect this and prompt the user to enter a different folder path. The user can also change the path defined near the top of the script in the $OutputFolder variable.

#PowerShell
#MIT
#vSpherePowerCLI

Statistics
0 Favorited
0 Views
1 Files
0 Shares
0 Downloads
Attachment(s)
ps1 file
snippet.ps1   2 KB   1 version
Uploaded - Apr 09, 2024

Tags and Keywords

Related Entries and Links

No Related Resource entered.