Latest version without proxy:
$ProgressPreference = "SilentlyContinue"
$baseUrl = "https://www.uziregister.nl"
$url = "$baseUrl/uzi-pas/activeer-en-installeer-uw-uzi-pas/overzicht-safesign-software"
$Path = "C:\Users\Public\Downloads"
$File = "safesign-ic-minidriver.zip"
# Check for existing installation and uninstall
$uninstallKeys = @(
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*",
"HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
)
$installed = Get-ItemProperty $uninstallKeys -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -like "*SafeSign*" }
if ($installed) {
Write-Host "Found existing installation: $($installed.DisplayName) v$($installed.DisplayVersion)"
$uninstallString = $installed.UninstallString
if ($uninstallString -match "msiexec") {
$productCode = $uninstallString -replace ".*(\{[A-F0-9-]+\}).*", '$1'
Write-Host "Uninstalling $productCode..."
Start-Process -FilePath "msiexec.exe" -ArgumentList "/x $productCode /qn" -Wait
Write-Host "Uninstall completed"
}
}
# Step 1: Get the document page link
$webRequest = Invoke-WebRequest -Uri $url -UseBasicParsing
$docLink = $webRequest.Links | Where-Object { $_.href -like "*windows-64-bits*" } | Select-Object -First 1 -ExpandProperty href
if (-not $docLink) {
Write-Host "Could not find Windows 64-bits link on overview page" -ForegroundColor Red
exit 1
}
if ($docLink -notmatch "^https?://") {
$docLink = "$baseUrl$docLink"
}
Write-Host "Document page: $docLink"
# Step 2: Get the actual download link from the document page
$docRequest = Invoke-WebRequest -Uri $docLink -UseBasicParsing
$downloadLink = $docRequest.Links | Where-Object { $_.href -like "*.zip" } | Select-Object -First 1 -ExpandProperty href
if (-not $downloadLink) {
Write-Host "Could not find download link on document page" -ForegroundColor Red
exit 1
}
Write-Host "Downloading from: $downloadLink"
# Step 3: Download and install
Invoke-WebRequest -Uri $downloadLink -OutFile "$Path\$File" -UseBasicParsing
Expand-Archive "$Path\$File" $Path -Force
$msiFile = Get-ChildItem -Path "$Path\x64" -Filter *.msi | Select-Object -First 1 -ExpandProperty Name
if (-not $msiFile) {
Write-Host "MSI file not found in x64 folder" -ForegroundColor Red
exit 1
}
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$Path\x64\$msiFile`" /qn /L*v `"$Path\$File.log`"" -Wait
$statusLine = Get-Content "$Path\$File.log" -Tail 100 | Where-Object { $_ -match "Productnaam:" }
if ($statusLine) {
Write-Host $statusLine
if ($statusLine -match ": 0\.$") {
Write-Host "Installation successful" -ForegroundColor Green
} else {
Write-Host "Installation failed" -ForegroundColor Red
}
} else {
Write-Host "Status line not found" -ForegroundColor Red
}
With proxy:
$ProgressPreference = "SilentlyContinue"
$url = "https://www.uziregister.nl/uzi-pas/activeer-en-installeer-uw-uzi-pas/overzicht-safesign-software"
$webRequest = Invoke-WebRequest -Uri $url -Proxy http://proxy.ezorg.nl:8080 -ProxyUseDefaultCredentials -UseBasicParsing
$hrefContent = $webRequest.Links | Where-Object { $_.outerHTML -like "*Windows 64-bits*" } | Select-Object -ExpandProperty href
$Link = ($hrefContent -split '\s')[0]
Write-Host "Downloading from: $Link"
$Path = "C:\Users\Public\Downloads"
$File = "safesign-ic-minidriver.zip"
Invoke-WebRequest -Uri $Link -Proxy http://proxy.ezorg.nl:8080 -ProxyUseDefaultCredentials -OutFile "$Path\$File" -UseBasicParsing
Expand-Archive "$Path\$File" $Path -Force
$msiFile = Get-ChildItem -Path "$Path\x64" -Filter *.msi | Select-Object -ExpandProperty Name
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$Path\x64\$msiFile`" /qn /L*v `"$Path\$File.log`"" -Wait
$statusLine = Get-Content "$Path\$File.log" -Tail 100 | Where-Object { $_ -match "Productnaam:" }
if ($statusLine) {
Write-Host $statusLine
if ($statusLine -match ": 0\.$") {
Write-Host "Installation successful" -ForegroundColor Green
} else {
Write-Host "Installation failed" -ForegroundColor Red
}
} else {
Write-Host "Status line not found" -ForegroundColor Red
}
SafeSign IC MiniDriver 4.4.0.0:
$ProgressPreference = "SilentlyContinue"
$Link = "https://www.vzvz.nl/media/downloads/zorg-id-safesign-windows"
$Path = "C:\Users\Public\Downloads"
$File = "safesign-windows.zip"
Invoke-WebRequest -Uri $Link -Proxy http://proxy.ezorg.nl:8080 -ProxyUseDefaultCredentials -OutFile "$Path\$File" -UseBasicParsing
Expand-Archive "$Path\$File" $Path -Force
$NewestFolder = Get-ChildItem -Path $Path -Directory | Sort-Object CreationTime -Descending | Select-Object -First 1
$InnerZip = Get-ChildItem -Path $NewestFolder.FullName -Filter "*.zip" | Select-Object -First 1
Expand-Archive $InnerZip.FullName $NewestFolder.FullName -Force
$x64Path = Join-Path $NewestFolder.FullName "x64"
$msiFile = Get-ChildItem -Path "$x64Path" -Filter *.msi | Select-Object -First 1
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$($msiFile.FullName)`" /qn /L*v `"$Path\$File.log`"" -Wait
$statusLine = Get-Content "$Path\$File.log" -Tail 100 | Where-Object { $_ -match "Productnaam:" }
if ($statusLine) {
Write-Host $statusLine
if ($statusLine -match ": 0\.$") {
Write-Host "Installation successful" -ForegroundColor Green
} else {
Write-Host "Installation failed" -ForegroundColor Red
}
} else {
Write-Host "Status line not found" -ForegroundColor Red
}