_:n3019bb973a8b4d4ba888985e13d58e2cxb2
<http://schema.org/text>
"I went ahead and remove the part of the script that verifies the 'lastwritetime' of that 'NvidiaDrivers' folder on the remote machine, barring issues like we had before like Firewall issues etc., that folder will always get created, and the driver package copied, so there really is no reason to keep it lol. I think I got a little overly carried away.The modified script SHOULD work for you finally, I tested this on my end and it worked, so hopefully you get the same results.&lt;#\n    .Description\n        Remote Install and update Nvidia Display Drivers on remote workstation\n    .Notes\n        TBD\n#&gt;\n###############################################\n# Editable Variables Begin                    #\n###############################################\n# You only have to edit this part of the script\n################################################\n# List of workstations you will be remotely updating Drivers on\n# Multiple computers Example: $Computers = @(\"Computer1\", \"Computer2\", \"Computer3\")\n$Computers = @(\"ESI14\")\n# Grabs todays date and formats it (Example: 02/21/2020 18:08:00)\n$TodayDate = Get-Date -UFormat \"%m/%d/%Y %T\"\n# This is the verison of the Display Driver that is pulled from Add/Remove Programs.\n# Make sure it matches the version you are installing.\n$UTDVersion = '442.19'\n# $InstArgs are the switches that Nvidia's setup.exe will use.\n# Currently the behavior is a silent/clean install with a supressed reboot.\n$InstArgs = @(\"-s\", \"-noreboot\", \"-clean\")\n# Folder name variable, edit this if you want to change the name of the root folder where your drivers live.\n$FolderName = \"NvidiaDrivers\"\n# This is where the below script will pull the drivers that are to be copied to the remote computer.\n# All driver files should be at the root of your $Folder\n$PackageSource = \"\\\\lore\\Drivers\\$FolderName\"\n# This is the path where your log file .csv will be stored\n$LogFilePath = \"\\\\lore\\Drivers\\$FolderName\"\n# These are the Robocopy.exe Arguments, you should not have to touch these\n$RoboArgs = @(\"/S\", \"/E\", \"/NP\", \"/NFL\", \"/NDL\", \"/NJH\", \"/NJS\", \"/MT:32\", \"/R:2\", \"/W:1\")\n###############################################\n# Editable Variables End                      #\n###############################################\n\n######################################################################################################\n# No edits should take place beyond this comment. All changes should be made in the Variables section\n######################################################################################################\n# This Foreach statement will iterate and run the code on each $Computer in your array\nForeach ($Computer in $Computers) {\n\t#Tests connection to remote workstation in your $Computer array, if this fails an error will be output (See line 64)\n\tIf (Test-Connection -ComputerName $Computer -Count 3 -ErrorAction SilentlyContinue) {\n\t\t# This test to see if the folder where the Driver package will be copied exists on the remote $Computer\n\t\t$RemoteDirectoryExists = Test-Path \"\\\\$Computer\\C$\\$FolderName\"\n\t\tIF (!($RemoteDirectoryExists)) {\n\t\t\t# If the the C:\\NvidiaDrivers directory does not exist on the remote workstation, the New-Item cmdlet will create it.\n\t\t\tWrite-Host \"Creating $FolderName Directory on 'C:\\' of $Computer.\"\n\t\t\tNew-Item -Path \"\\\\$Computer\\C$\\$FolderName\" -ItemType Directory -Force\n\t\t\tStart-Sleep -Seconds 5\n\t\t}\n\t\t# This check to see if C:\\NvidiaDrivers folder contains and files, and if it does, they will be deleted.\n\t\t# This ensures only the latest drivers are being installed, and to prevent conflict if any changes are made on Nvidia's end\n\t\t$DriversPresent = Test-Path \"\\\\$Computer\\C$\\$FolderName\\*\"\n\t\tIf ($DriversPresent) {\n\t\t\tWrite-Host \"Previous driver package detected, removing..\"\n\t\t\t# This will empty/delete the C:\\NvidiaDrivers directory\n\t\t\tRemove-Item \"\\\\$Computer\\C$\\$FolderName\\*\" -Recurse -Force\n\t\t\tStart-Sleep -Seconds 5\n\t\t}\n\t\t# This copies over the Driver Package from your $PackageSource to the remote $Computer\n\t\tWrite-Host \"Copying new Driver Package to $Computer.\"\n\t\tRobocopy.exe \"$PackageSource\" \"\\\\$Computer\\C$\\$FolderName\" $RoboArgs\n\t\tStart-Sleep -Seconds 5\n\t\t# This checks the Modified Date of the C:\\NvidiaDrivers folder and checks it against Today's Date ($TodayDate variable).\n\t\t# The IF statement is a little extra validation to make sure the copying of the Driver Package is successful, ensuring a sucessful driver update to the latest and greatest you provided.\n\t\tWrite-Host \"Updating Nvidia Display Driver for: $Computer.\"\n\t\tInvoke-Command -ComputerName \"$Computer\" {\n\t\t\tStart-Process \"C:\\$Using:FolderName\\setup.exe\" -ArgumentList \"$Using:InstArgs\" -ErrorAction SilentlyContinue -Wait\n\t\t}\n\t\t# This runs the Get-Package command on the remote computer to verify the driver installation itself was successful.\n\t\tWrite-Host \"Verifying Display Driver update for $Computer was successful..\"\n\t\tWrite-Host \"Log file will be saved to: $LogFilePath\"\n\t\t$InstallSuccessful = Invoke-Command -ComputerName $Computer {\n\t\t\tGet-Package -ProviderName Programs -Name \"NVIDIA Graphics Driver*\" -RequiredVersion \"$Using:UTDVersion\" -Force | Select-Object -ExpandProperty Version\n\t\t}\n\t\t# This takes the results of that Get-Package driver check and outputs it top the $LogFilePath you specified in the Variable section.\n\t\t$Results = If ($InstallSuccessful -eq $UTDVersion) {\n\t\t\tWrite-Output \"Driver update for $Computer was successful\"\n\t\t}\n\t\tElseif ($InstallSuccessful -ne $UTDVersion) {\n\t\t\tWrite-Output \"Driver update for $Computer was not successful.\"\n\t\t} $Results | Out-File -FilePath \"$LogFilePath\\Results.csv\" -Append -NoClobber -Force\n            \n\t}\n\tElse { Write-Host \"Error: $Computer is not reachable over the network.\" }\n}"
<https://community.spiceworks.com/topic/2258321-installing-nvidia-studio-drivers-to-workstations-over-the-network>