-
Notifications
You must be signed in to change notification settings - Fork 126
Add PowerShell debug script to gather Windows 11 info #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pcgeek86
wants to merge
1
commit into
NVIDIA:main
Choose a base branch
from
pcgeek86:debug-pwsh-script
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,189 @@ | ||
| # Set output file | ||
| $outputFile = "print_env.txt" | ||
|
|
||
| # Clear/create the output file | ||
| "" | Set-Content -Path $outputFile | ||
|
|
||
| # OS Information | ||
| "***OS Information***" | Add-Content -Path $outputFile | ||
| $osInfo = Get-ComputerInfo -Property WindowsVersion, OsArchitecture, OsName, WindowsInstallDateUTC | ||
| "OS Name: $($osInfo.OsName)" | Add-Content -Path $outputFile | ||
| "OS Architecture: $($osInfo.OsArchitecture)" | Add-Content -Path $outputFile | ||
| "Windows Version: $($osInfo.WindowsVersion)" | Add-Content -Path $outputFile | ||
| "Install Date (UTC): $($osInfo.WindowsInstallDateUTC)" | Add-Content -Path $outputFile | ||
| "" | Add-Content -Path $outputFile | ||
|
|
||
| # GPU Information | ||
| "***GPU Information***" | Add-Content -Path $outputFile | ||
| try { | ||
| $gpuOutput = & nvidia-smi 2>&1 | ||
| if ($LASTEXITCODE -ne 0) { | ||
| "nvidia-smi not found or no NVIDIA GPU detected" | Add-Content -Path $outputFile | ||
| } | ||
| else { | ||
| $gpuOutput | Add-Content -Path $outputFile | ||
| } | ||
| } | ||
| catch { | ||
| "nvidia-smi not found or no NVIDIA GPU detected" | Add-Content -Path $outputFile | ||
| } | ||
| "" | Add-Content -Path $outputFile | ||
|
|
||
| # CPU Information | ||
| "***CPU***" | Add-Content -Path $outputFile | ||
| $cpuInfo = Get-WmiObject Win32_Processor | ||
| "Name: $($cpuInfo.Name)" | Add-Content -Path $outputFile | ||
| "Cores: $($cpuInfo.NumberOfCores)" | Add-Content -Path $outputFile | ||
| "Logical Processors: $($cpuInfo.NumberOfLogicalProcessors)" | Add-Content -Path $outputFile | ||
| "Architecture: $($cpuInfo.Architecture)" | Add-Content -Path $outputFile | ||
| "Speed (MHz): $($cpuInfo.MaxClockSpeed)" | Add-Content -Path $outputFile | ||
| "" | Add-Content -Path $outputFile | ||
|
|
||
| # CMake | ||
| "***CMake***" | Add-Content -Path $outputFile | ||
| try { | ||
| $cmakePath = (Get-Command cmake -ErrorAction SilentlyContinue).Source | ||
| if ($cmakePath) { | ||
| "cmake found at: $cmakePath" | Add-Content -Path $outputFile | ||
| $cmakeOutput = & cmake --version 2>&1 | ||
| $cmakeOutput | Add-Content -Path $outputFile | ||
| } | ||
| else { | ||
| "cmake not found" | Add-Content -Path $outputFile | ||
| } | ||
| } | ||
| catch { | ||
| "cmake not found" | Add-Content -Path $outputFile | ||
| } | ||
| "" | Add-Content -Path $outputFile | ||
|
|
||
| # g++ | ||
| "***g++***" | Add-Content -Path $outputFile | ||
| try { | ||
| $gppPath = (Get-Command g++ -ErrorAction SilentlyContinue).Source | ||
| if ($gppPath) { | ||
| "g++ found at: $gppPath" | Add-Content -Path $outputFile | ||
| $gppOutput = & g++ --version 2>&1 | ||
| $gppOutput | Add-Content -Path $outputFile | ||
| } | ||
| else { | ||
| "g++ not found" | Add-Content -Path $outputFile | ||
| } | ||
| } | ||
| catch { | ||
| "g++ not found" | Add-Content -Path $outputFile | ||
| } | ||
| "" | Add-Content -Path $outputFile | ||
|
|
||
| # nvcc | ||
| "***nvcc***" | Add-Content -Path $outputFile | ||
| try { | ||
| $nvccPath = (Get-Command nvcc -ErrorAction SilentlyContinue).Source | ||
| if ($nvccPath) { | ||
| "nvcc found at: $nvccPath" | Add-Content -Path $outputFile | ||
| $nvccOutput = & nvcc --version 2>&1 | ||
| $nvccOutput | Add-Content -Path $outputFile | ||
| } | ||
| else { | ||
| "nvcc not found" | Add-Content -Path $outputFile | ||
| } | ||
| } | ||
| catch { | ||
| "nvcc not found" | Add-Content -Path $outputFile | ||
| } | ||
| "" | Add-Content -Path $outputFile | ||
|
|
||
| # Python | ||
| "***Python***" | Add-Content -Path $outputFile | ||
| try { | ||
| $pythonPath = (Get-Command python -ErrorAction SilentlyContinue).Source | ||
| if ($pythonPath) { | ||
| "python found at: $pythonPath" | Add-Content -Path $outputFile | ||
| $pythonOutput = & python -c "import sys; print('Python {0}.{1}.{2}'.format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))" 2>&1 | ||
| $pythonOutput | Add-Content -Path $outputFile | ||
| } | ||
| else { | ||
| "python not found" | Add-Content -Path $outputFile | ||
| } | ||
| } | ||
| catch { | ||
| "python not found" | Add-Content -Path $outputFile | ||
| } | ||
| "" | Add-Content -Path $outputFile | ||
|
|
||
| # uv | ||
| "***uv***" | Add-Content -Path $outputFile | ||
| try { | ||
| $uvPath = (Get-Command uv -ErrorAction SilentlyContinue).Source | ||
| if ($uvPath) { | ||
| "uv found at: $uvPath" | Add-Content -Path $outputFile | ||
| $uvOutput = & uv --version 2>&1 | ||
| $uvOutput | Add-Content -Path $outputFile | ||
| } | ||
| else { | ||
| "uv not found" | Add-Content -Path $outputFile | ||
| } | ||
| } | ||
| catch { | ||
| "uv not found" | Add-Content -Path $outputFile | ||
| } | ||
| "" | Add-Content -Path $outputFile | ||
|
|
||
| # Environment Variables | ||
| "***Environment Variables***" | Add-Content -Path $outputFile | ||
| $envVars = @( | ||
| 'PATH', | ||
| 'PYTHONPATH', | ||
| 'CONDA_PREFIX', | ||
| 'CUDA_PATH', | ||
| 'CUDA_HOME', | ||
| 'NUMBAPRO_NVVM', | ||
| 'NUMBAPRO_LIBDEVICE' | ||
| ) | ||
|
|
||
| foreach ($var in $envVars) { | ||
| $value = [System.Environment]::GetEnvironmentVariable($var) | ||
| if ([string]::IsNullOrEmpty($value)) { | ||
| $value = "(not set)" | ||
| } | ||
| ("{0,-32}: {1}" -f $var, $value) | Add-Content -Path $outputFile | ||
| } | ||
| "" | Add-Content -Path $outputFile | ||
|
|
||
| # Package Management | ||
| "***Python Packages***" | Add-Content -Path $outputFile | ||
| try { | ||
| $condaPath = (Get-Command conda -ErrorAction SilentlyContinue).Source | ||
| if ($condaPath) { | ||
| "conda found at: $condaPath" | Add-Content -Path $outputFile | ||
| "" | Add-Content -Path $outputFile | ||
| $condaOutput = & conda list 2>&1 | ||
| $condaOutput | Add-Content -Path $outputFile | ||
| } | ||
| else { | ||
| try { | ||
| $pipPath = (Get-Command pip -ErrorAction SilentlyContinue).Source | ||
| if ($pipPath) { | ||
| "conda not found" | Add-Content -Path $outputFile | ||
| "pip found at: $pipPath" | Add-Content -Path $outputFile | ||
| "" | Add-Content -Path $outputFile | ||
| $pipOutput = & pip list 2>&1 | ||
| $pipOutput | Add-Content -Path $outputFile | ||
| } | ||
| else { | ||
| "conda not found" | Add-Content -Path $outputFile | ||
| "pip not found" | Add-Content -Path $outputFile | ||
| } | ||
| } | ||
| catch { | ||
| "conda not found" | Add-Content -Path $outputFile | ||
| "pip not found" | Add-Content -Path $outputFile | ||
| } | ||
| } | ||
| } | ||
| catch { | ||
| "conda not found" | Add-Content -Path $outputFile | ||
| } | ||
| "" | Add-Content -Path $outputFile | ||
|
|
||
| Write-Host "Environment information has been written to $outputFile" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a new line to the end of file. |
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use
Get-CimInstanceinstead?Get-WmiObjectis no longer supported since PowerShell 3.0