NVIDIA vGPU License Deployer

This PowerShell script automates remote management tasks for NVIDIA vGPU License clients on computers in an Active Directory environment. The script performs the following tasks:

  1. Clears specific files in NVIDIA client configuration folders and deploys new files.
  2. Restarts a display-related service.
  3. Executes a script to disable display adapters (VMware SVGA 3D or Microsoft Basic Display Adapter) on remote machines. It is recommended to keep it disabled by NVIDIA.

Prerequisites

  • Active Directory Module: Ensure the Active Directory module for PowerShell is installed on the machine running this script.
  • PsExec: Place PsExec.exe at C:\Windows\System32\ on the machine running this script. PsExec is used to execute commands on remote systems.
  • Remote Machines: The script is configured to target machines with names starting with “VDI” in Active Directory. Modify this filter as needed for other naming conventions.
  • Permissions: Run the script with administrator privileges to ensure access to remote computers and services.

How to Use

Step 1: Download the Scripts

Download the NVIDIAVGPULicenseDeployerv1.ps1 and DisableDisplayAdapters.ps1 PowerShell scripts to a directory on your local machine. Next, create a folder named IT on the C:\ drive and copy the DisableDisplayAdapters.ps1 script into the C:\IT folder. You can download the script by visiting my GitHub page.

Step 2: Run the Script

  1. Open PowerShell as an administrator.
  2. Navigate to the directory containing NVIDIAVGPULicenseDeployerv1.ps1.
  3. Run the script:
.\NVIDIAVGPULicenseDeployerv1.ps1

Step 3: Choose an Option

The script presents a menu with options for different tasks. Enter the number corresponding to the task you want to perform and press Enter.

Options:

  1. Copy Client Configuration Files
    Clears .tok files in the ClientConfigToken folder of each target machine, copies new .tok files from C:\IT on the source machine, and ensures any .ps1 files from C:\IT on the source machine are also copied to C:\IT on the target machine.
  2. Restart NVDisplay Service
    Restarts the NVDisplay.ContainerLocalSystem service on each target machine. If the service is stopped, it starts the service.
  3. Disable Display Adapters
    Runs the DisableDisplayAdapters.ps1 script on each target machine using PsExec. Ensure DisableDisplayAdapters.ps1 is located in C:\IT on the local machine before running this option.
  4. Exit
    Exits the script.

Logging

The script logs successful and failed actions to separate files in C:\ITLogs:

  • SuccessLog.log for completed actions.
  • FailureLog.log for errors encountered during execution.

Example Log Entry

A sample entry in the success log might look like:

[2024-10-25 14:30:45] Service 'NVDisplay.ContainerLocalSystem' started on VDI001

Notes

  • Ensure network connectivity and proper permissions for accessing each target machine.
  • Modify machine name filters and paths if required by your environment.

Thank you for reading, and I hope this guide helps you while using my script. If you have any questions, feel free to leave a comment.

Wishing you a successful day!

Best regards,
Hasan

Published by Hasan Altin

I don't see any difference between the one who doesn't share its knowledge or the one who doesn't share its bread.

Leave a Reply

Your email address will not be published. Required fields are marked *