Skip to content

Instantly share code, notes, and snippets.

@paulloz
Last active September 20, 2023 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulloz/c663d53bec2accac9d0cb46db333ecfd to your computer and use it in GitHub Desktop.
Save paulloz/c663d53bec2accac9d0cb46db333ecfd to your computer and use it in GitHub Desktop.
A script to gather some useful data about Godot and .NET, to help people with installation problems.
# This can be called directly with:
# Set-ExecutionPolicy Bypass -Scope Process -Force; try { Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://gist.githubusercontent.com/paulloz/c663d53bec2accac9d0cb46db333ecfd/raw/4f6778445b9d81748acddacbfb81093264c216cb/InstallationReport.ps1 -UseBasicParsing))) } catch { Write-Error $_ }
function Write-Header {
param (
[Parameter(Mandatory)]
[string]$Text
)
Write-Output ("-" * 99)
Write-Output ("-- $Text")
Write-Output ("-" * 99)
}
function Write-Footer {
Write-Output ("-" * 99)
Write-Output ("")
}
function Get-FileContent {
param (
[Parameter(Mandatory)]
[string]$Path
)
if (Test-Path -Path $Path -PathType Leaf) {
Get-Content -Path $Path
}
else {
Write-Output "-- File does not exist."
}
}
function Start-All {
Write-Header "dotnet --info"
dotnet --info
Write-Footer
Write-Header "Some interesting environment variables"
foreach ($key in @("DOTNET_ROOT", "MSBuildSDKsPath")) {
Write-Output "$key=$([System.Environment]::GetEnvironmentVariable($key))"
}
Write-Footer
Write-Header "dotnet nuget list source"
dotnet nuget list source
Write-Footer
Write-Header "DIR %APPDATA%\NuGet\"
Get-ChildItem -Path $env:APPDATA\NuGet -Recurse -File -Name
Write-Footer
Write-Header "%APPDATA%\NuGet\NuGet.Config"
Get-FileContent -Path $env:APPDATA\NuGet\NuGet.Config
Write-Footer
Write-Header "%APPDATA%\NuGet\config\Godot.Offline.Config"
Get-FileContent -Path $env:APPDATA\NuGet\config\Godot.Offline.Config
Write-Footer
}
($exists = Get-Command dotnet) *> $null
if (-not($exists)) {
Write-Output "The dotnet command could not be found..."
Write-Output "Did you install the .NET SDK? https://dotnet.microsoft.com/en-us/download"
}
else {
$file = New-TemporaryFile
Write-Output "Gathering data..."
Start-All | Out-File -FilePath $file.FullName
Write-Output "Done."
Write-Output "Opening report..."
Write-Output "You can now redact any personal information (although, nothing should be too sensitive), and share the report."
Write-Output "Please close the notepad window when you're done."
(Start-Process notepad $file.FullName -PassThru).WaitForExit()
Remove-Item $file.FullName -Force
}
Write-Host "All done. Press enter key to exit." -NoNewline
$Host.UI.ReadLine()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment