lord-carlos / nvidia-update

Checks for a new version of the Nvidia Driver, downloads and installs it.
MIT License
147 stars 29 forks source link

7z check does not account for 64bit installs #8

Closed cole-h closed 4 years ago

cole-h commented 6 years ago

I am on Windows 10 x64 and I have the x64 version of 7z installed (to C:\Program Files); the check for whether or not 7z exists checks the C:\Program Files (x86) directory. To fix this, I changed $env:programfiles to $env:ProgramW6432 on lines 28-9 and 104. Maybe add another setting at the top to specify if your archiver install is x64 as opposed to x86?

However, I am willing to believe this is a quirk with my system (wouldn't surprise me).

SkilledAlpaca commented 6 years ago

My 7zip is installed in C:\Program Files\7-Zip and I'm on Windows 10 x64. I have not had any issues with the script. Can you post the error you're getting and copy paste it here?

cole-h commented 6 years ago

Sorry but it looks like you don't have a supported archiver. Please install 7zip or WinRAR. Press any key to exit...

By running the ps1 exactly as it is found in the repo, this is what I am greeted with. By changing if (Test-Path $env:programfiles\7-zip\7z.exe) { $archiverProgram = "$env:programfiles\7-zip\7z.exe" to if (Test-Path $env:ProgramW6432\7-zip\7z.exe) { $archiverProgram = "$env:ProgramW6432\7-zip\7z.exe"

I am greeted with this: https://pastebin.com/KYr7xjAE.

I fixed that error by changing if($archiverProgram = "$env:programfiles\7-zip\7z.exe") { to if($archiverProgram = "$env:ProgramW6432\7-zip\7z.exe") {. After that, everything works.

(BTW: I forced the detected driver version to 111.11 because I'm already on the latest version and otherwise the error would not pop up because, well, it didn't need to try and install anything)

SkilledAlpaca commented 6 years ago

Can you replace lines 28-38 with this block of code? I borrowed this from @z4rticus's fork.

$7z=(dir $env:ProgramFiles* 7z.exe -r).fullname
$winrar=(dir $env:ProgramFiles* winrar.exe -r).fullname
if ($7z) {
    $archiverProgram = $7z
} elseif ($winrar) {
$archiverProgram = $winrar
} else {
    Write-Host "Sorry but it looks like you don't have a supported archiver."
    Write-Host "Please install 7zip or WinRAR."
    Write-Host "Press any key to exit..."
    $key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
    exit
}
cole-h commented 6 years ago

That leaves me with this: https://pastebin.com/K0PzgiUz

SkilledAlpaca commented 6 years ago

For giggles, can you run this in an admin powershell window for me? Set-ExecutionPolicy Unrestricted

Then try running the attached version for me. nvidia_issue8.zip

cole-h commented 6 years ago

https://pastebin.com/ZAXdwCGa

Could I have messed up my 7z installation somehow?

SkilledAlpaca commented 6 years ago

Can you open a powershell window and do the following commands? Each of these will let me know if it can list every file in the Program Files/Program Files x86 folder. From what I gather, it's getting hung up on looking for the 7zip executable. I only need the output if it errors out.

cd 'C:\Program Files\'
Get-ChildItem -Recurse
cd 'C:\Program Files (x86)\'
Get-ChildItem -Recurse

Then can you give me the output of this command: $PSVersionTable

cole-h commented 6 years ago

$PSVersionTable output:

Name                           Value
----                           -----
PSVersion                      5.1.15063.138
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.138
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

x64 Program Files didn't return any errors, but the x86 one did:

Get-ChildItem : Access to the path 'C:\Program Files (x86)\Google\CrashReports' is denied.
At line:1 char:1
+ Get-ChildItem -Recurse > C:\Users\Cole\Desktop\workspace\x86_programf ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\Program File...le\CrashReports:String) [Get-ChildItem], Unauthoriz
   edAccessException
    + FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand

Get-ChildItem : Could not find a part of the path 'C:\Program Files (x86)\NVIDIA
Corporation\NvContainer\plugins\SPUser\nvspcaps'.
At line:1 char:1
+ Get-ChildItem -Recurse > C:\Users\Cole\Desktop\workspace\x86_programf ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ReadError: (C:\Program File...SPUser\nvspcaps:String) [Get-ChildItem], DirectoryNotFound
   Exception
    + FullyQualifiedErrorId : DirIOError,Microsoft.PowerShell.Commands.GetChildItemCommand