# Prompt user to enter paths for the Downloads, Metadata, Depot Data, and Logs directories $Downloads = Read-Host "Please enter path for the Downloads" $MetadataLocation = Read-Host "Please enter path for the Metadata" $DepotdataLocation = Read-Host "Please enter path for the Depot Data" $LogsLocation = Read-Host "Please enter path for the Logs" # Function to create directory if it doesn't exist function Ensure-Directory { param ( [string]$Path ) if (-Not (Test-Path -Path $Path)) { New-Item -Path $Path -ItemType Directory | Out-Null Write-Output "Directory created: $Path" } else { Write-Output "Directory already exists: $Path" } } # Ensure all specified directories exist Ensure-Directory -Path $Downloads Ensure-Directory -Path $MetadataLocation Ensure-Directory -Path $DepotdataLocation Ensure-Directory -Path $LogsLocation # Function to download a file function Download-File { param ( [string]$Url, [string]$DestinationPath ) try { Invoke-WebRequest -Uri $Url -OutFile $DestinationPath Write-Output "Downloaded: $Url to $DestinationPath" } catch { Write-Error "Failed to download $Url" } } # Downloads - Place downloads below here # Define the source URLs $sdpSrc = 'https://swarm.workshop.perforce.com/downloads/guest/perforce_software/sdp/downloads/sdp.Windows.zip' $p4dSrc = 'https://ftp.perforce.com/perforce/r24.1/bin.ntx64/p4d.exe' $p4Src = 'https://ftp.perforce.com/perforce/r24.1/bin.ntx64/p4.exe' $pythonSrc = 'https://www.python.org/ftp/python/3.12.3/python-3.12.3-amd64.exe' $nppSrc = 'https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8.6.5/npp.8.6.5.Installer.x64.exe' $gowSrc = 'https://github.com/bmatzelle/gow/releases/download/v0.8.0/Gow-0.8.0.exe' # Define the destination paths $sdpDest = Join-Path -Path $Downloads -ChildPath 'sdp.Windows.zip' $p4dDest = Join-Path -Path $Downloads -ChildPath 'p4d.exe' $p4Dest = Join-Path -Path $Downloads -ChildPath 'p4.exe' $pythonDest = Join-Path -Path $Downloads -ChildPath 'python-3.12.3-amd64.exe' $nppDest = Join-Path -Path $Downloads -ChildPath 'npp.8.6.5.Installer.x64.exe' $gowDest = Join-Path -Path $Downloads -ChildPath 'Gow-0.8.0.exe' # Download files Download-File -Url $sdpSrc -DestinationPath $sdpDest Download-File -Url $p4dSrc -DestinationPath $p4dDest Download-File -Url $p4Src -DestinationPath $p4Dest Download-File -Url $pythonSrc -DestinationPath $pythonDest Download-File -Url $nppSrc -DestinationPath $nppDest Download-File -Url $gowSrc -DestinationPath $gowDest # Extract SDP archive $extractPath = Join-Path -Path $DepotdataLocation -ChildPath 'sdp.Windows' Ensure-Directory -Path $extractPath try { Expand-Archive -Path $sdpDest -DestinationPath $extractPath -Force Write-Output "Extracted: $sdpDest to $extractPath" } catch { Write-Error "Failed to extract $sdpDest" } # Move SDP folder Move-Item -Path "$DepotdataLocation\sdp.Windows\sdp" -Destination "$DepotdataLocation\sdp" # Clean up sdp.windows Remove-Item -Path "$DepotdataLocation\sdp.Windows" -Recurse # Move p4 and p4d to setup location Move-Item -Path "$p4Dest" -Destination "$DepotdataLocation\sdp\Server\Windows\setup" Move-Item -Path "$p4dDest" -Destination "$DepotdataLocation\sdp\Server\Windows\setup" # Optionally, you can clean up the .zip file after extraction # Remove-Item -Path $sdpDest # Set PowerShell execution policy Write-Output "Current execution policy: $(Get-ExecutionPolicy)" Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force Write-Output "Execution policy set to RemoteSigned" # Output the paths of the created directories and the downloaded files Write-Output "Downloads directory: $Downloads" Write-Output "Metadata directory: $MetadataLocation" Write-Output "Depot Data directory: $DepotdataLocation" Write-Output "Logs directory: $LogsLocation" # Tools Installation Write-Output "Would you like to install Notepad++, Gow, and Python silently? (y/n)" $response = Read-Host if ($response -eq 'y') { # Install Notepad++ silently Start-Process -FilePath $nppDest -ArgumentList '/S' -Wait # Install Gow silently Start-Process -FilePath $gowDest -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART' -Wait # Install Python silently Start-Process -FilePath $pythonDest -ArgumentList '/s' -Wait } else { Write-Output "Not installing Notepad++, Gow, and Python." } # End of script Write-Output "Script completed successfully."
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 30388 | C. Thomas Tyler |
Released SDP 2024.1.30385 (2024/06/11). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
//guest/perforce_software/sdp/dev/Server/Windows/test/sdp_Win_Install.ps1 | |||||
#1 | 30374 | simon.riley | Test |