<# Powershell Migration von winalldatnet_program_group_usr.vbs - by Ronald Arnold 22.09.2025 Creates Start Menu shortcuts for "WinAlldat Net" (current user) and optional desktop shortcut. Mirrors the original VBS: asks for base path (default d:\winalldatnet), creates: - WinAlldat Net IVDK.lnk (winalldatnet.exe) - WinAlldat Net Installationshinweise.lnk (ivdksetupnet.txt) - WinAlldat Net Download.lnk (WinAlldat Net_dl.url) - WinAlldat Net Video Tutorials.lnk (WinAlldat Net_video.url) - WinAlldat Net Datenbanktest.lnk (winalldatnet.exe -dbtest) - WinAlldat Net Reporting.lnk (winalldatnet.exe -report) #> [CmdletBinding()] param() Add-Type -AssemblyName Microsoft.VisualBasic function New-Shortcut { param( [Parameter(Mandatory)] [string] $LinkPath, [Parameter(Mandatory)] [string] $TargetPath, [string] $Description = "", [string] $Arguments = "", [string] $IconPath = $null ) $shell = New-Object -ComObject WScript.Shell $sc = $shell.CreateShortcut($LinkPath) $sc.TargetPath = $TargetPath if ($IconPath) { $sc.IconLocation = $IconPath } $sc.Arguments = $Arguments $sc.Description = $Description $sc.WindowStyle = 4 # Normal (matches VBS) try { $sc.WorkingDirectory = [System.IO.Path]::GetDirectoryName($TargetPath) } catch {} $sc.Save() } $startMenu = [Environment]::GetFolderPath('StartMenu') $desktop = [Environment]::GetFolderPath('Desktop') $groupFolder = Join-Path $startMenu 'WinAlldat Net' $windir = $env:WINDIR $is64 = [Environment]::Is64BitOperatingSystem $defaultBase = 'd:\winalldatnet' # Ask for base path (like the VBS InputBox) $basePath = [Microsoft.VisualBasic.Interaction]::InputBox( "Pfad zur WinAlldat Net Software?", "Frage", $defaultBase ).Trim() if ([string]::IsNullOrWhiteSpace($basePath)) { [System.Windows.Forms.MessageBox]::Show("Missing value or termination!","Information",[System.Windows.Forms.MessageBoxButtons]::OK,[System.Windows.Forms.MessageBoxIcon]::Information) | Out-Null exit 1 } # Ensure Start Menu group exists if (-not (Test-Path -LiteralPath $groupFolder)) { New-Item -ItemType Directory -Path $groupFolder | Out-Null } # Confirm creation (like VBS MsgBox) $create = [System.Windows.Forms.MessageBox]::Show("WinAlldat Net Programmgruppe anlegen?", "Frage", [System.Windows.Forms.MessageBoxButtons]::YesNo, [System.Windows.Forms.MessageBoxIcon]::Question) if ($create -ne [System.Windows.Forms.DialogResult]::Yes) { exit } # --- Standard program links --- New-Shortcut -LinkPath (Join-Path $groupFolder 'WinAlldat Net IVDK.lnk') ` -TargetPath (Join-Path $basePath 'winalldatnet.exe') ` -Description 'Hauptprogramm' ` -IconPath (Join-Path $basePath 'winalldatnet.exe') New-Shortcut -LinkPath (Join-Path $groupFolder 'WinAlldat Net Installationshinweise.lnk') ` -TargetPath (Join-Path $basePath 'ivdksetupnet.txt') ` -Description 'Readme' ` -IconPath (Join-Path $basePath 'winalldatnet.exe') New-Shortcut -LinkPath (Join-Path $groupFolder 'WinAlldat Net Download.lnk') ` -TargetPath (Join-Path $basePath 'WinAlldat Net_dl.url') ` -Description 'Downloads' ` -IconPath (Join-Path $basePath 'winalldatnet.exe') New-Shortcut -LinkPath (Join-Path $groupFolder 'WinAlldat Net Video Tutorials.lnk') ` -TargetPath (Join-Path $basePath 'WinAlldat Net_video.url') ` -Description 'Videos' ` -IconPath (Join-Path $basePath 'winalldatnet.exe') New-Shortcut -LinkPath (Join-Path $groupFolder 'WinAlldat Net Datenbanktest.lnk') ` -TargetPath (Join-Path $basePath 'winalldatnet.exe') ` -Description 'DB-Check' ` -Arguments '-dbtest' ` -IconPath (Join-Path $basePath 'winalldatnet.exe') New-Shortcut -LinkPath (Join-Path $groupFolder 'WinAlldat Net Reporting.lnk') ` -TargetPath (Join-Path $basePath 'winalldatnet.exe') ` -Description 'Reporting' ` -Arguments '-report' ` -IconPath (Join-Path $basePath 'winalldatnet.exe') # Optional desktop shortcut $desktopAsk = [System.Windows.Forms.MessageBox]::Show("WinAlldat Net Programmverknüpfung auf dem Desktop anlegen?", "Frage", [System.Windows.Forms.MessageBoxButtons]::YesNo, [System.Windows.Forms.MessageBoxIcon]::Question) if ($desktopAsk -eq [System.Windows.Forms.DialogResult]::Yes) { New-Shortcut -LinkPath (Join-Path $desktop 'WinAlldat Net IVDK.lnk') ` -TargetPath (Join-Path $basePath 'winalldatnet.exe') ` -Description 'Hauptprogramm' ` -IconPath (Join-Path $basePath 'winalldatnet.exe') } Write-Host "Done."