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:
- Clears specific files in NVIDIA client configuration folders and deploys new files.
- Restarts a display-related service.
- 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
atC:\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
- Open PowerShell as an administrator.
- Navigate to the directory containing
NVIDIAVGPULicenseDeployerv1.ps1
. - 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:
- Copy Client Configuration Files
Clears.tok
files in theClientConfigToken
folder of each target machine, copies new.tok
files fromC:\IT
on the source machine, and ensures any.ps1
files fromC:\IT
on the source machine are also copied toC:\IT
on the target machine. - Restart NVDisplay Service
Restarts theNVDisplay.ContainerLocalSystem
service on each target machine. If the service is stopped, it starts the service. - Disable Display Adapters
Runs theDisableDisplayAdapters.ps1
script on each target machine using PsExec. EnsureDisableDisplayAdapters.ps1
is located inC:\IT
on the local machine before running this option. - 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