# Step 1, use Start-Transcript to capture the execution to a text file and set variables for connecting to Azure Table
#Start-Transcript -Path "C:\TempLogs\NvidiaAdapter-$(((get-date).ToUniversalTime()).ToString("yyyyMMddThhmmssZ")).log"
Start-Transcript -Path "C:\TempLogs\NvidiaAdapter.log"
#storage account details
$storageAccountName = 'laps1'
$tableName = 'PowershellReports'
$sasToken = '?sv=2020-08-04&ss=bfqt&srt=sco&sp=rwdlacuptfx&se=2022-10-19T15:25:02Z&st=2021-08-24T07:25:02Z&spr=https&sig=jqaTwTTsVOZu08Xu93GVAOtf4mmpKN5IiuMYgOcq%2F78%3D'
$dateTime = get-date
$partitionKey = 'displaydrivers'
# Step 2, Connect to Azure Table Storage
Install-Module -Name Az -Repository PSGallery -Force
Import-Module -Name Az
$storageCtx = New-AzStorageContext -StorageAccountName $storageAccountName -SasToken $sasToken
$table = (Get-AzStorageTable -Name $tableName -Context $storageCtx).CloudTable
# Step 3, Check for presence of hotfix
$graphics = gwmi Win32_VideoController | Where-Object {$_.Name.contains("NVIDIA") } |Select-Object Name
$nvidiadriver = $graphics.Name
$PatchCheck = "$nvidiadriver"
$model = (gwmi Win32_computersystem -computername $env:COMPUTERNAME).model
# Step 4, Write data to Table Storage and end transcript.
Write-Host "Writing to Azure Table $table"
Install-Module AzTable -Force
Add-AzTableRow -table $table -partitionKey $partitionKey -rowKey ([guid]::NewGuid().tostring()) -property @{
'LocalHostname' = $env:computername
'NvidiaAdaptername' = $PatchCheck
'Model' = $model
} | Out-Null
Stop-Transcript
No comments:
Post a Comment