Skip to content

Commit

Permalink
Script adaptation for PowerShell.
Browse files Browse the repository at this point in the history
  • Loading branch information
ILPlais committed Sep 14, 2023
1 parent 70071c7 commit 5bf8bb1
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions GetFindVUKOnllineDB.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Set the target directory
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
# The user is not an administrator: use the local directory
$target = "$env:APPDATA\aacs"
}
else {
# The user is an administrator: use the global directory
$target = "$env:ALLUSERSPROFILE\aacs"
}

# If the target directory is missing, create it
if (-not (Test-Path -Path $target -PathType Container)) {
Write-Host "Directory ""$target"" is missing!"
Write-Host "Creating ""$target"""
$null = New-Item -Path $target -ItemType Directory -ErrorAction Stop
}
else {
# Delete the existing KEYDB.cfg file
Remove-Item -Path "$target\KEYDB.cfg" -ErrorAction SilentlyContinue
}

# Get the list of zip file links from the website
$links = (Invoke-WebRequest -UseBasicParsing -Uri "http://fvonline-db.bplaced.net/").Links | Where-Object { $_.href -like "http://*/fv_download.php?lang=*" } | Select-Object -ExpandProperty href

# Create a temporary directory
$tempdir = Join-Path $env:TEMP $(New-Guid)
New-Item -Type Directory -Path $tempdir | Out-Null

# For each link
foreach ($link in $links) {
# Download the zip file
Write-Host "Downloading the ""$link"" file�"
Invoke-WebRequest -UseBasicParsing -Uri $link -OutFile "$tempdir\keydb.zip"

# Unzip the file
Expand-Archive -Path "$tempdir\keydb.zip" -DestinationPath $tempdir

# Add the contents of the keydb.cfg file to the KEYDB.cfg
Add-Content -Path "$target\KEYDB.cfg" -Value (Get-Content -Path "$tempdir\keydb.cfg")

# Remove the downloaded and extracted files
Remove-Item -Path "$tempdir\*" -Force
}

# Remove the temporary directory
Remove-Item -Path $tempdir -Force

0 comments on commit 5bf8bb1

Please sign in to comment.