feat: Add Install-Dependencies.ps1 for SharePoint XLS Converter setup
This commit is contained in:
parent
5e13c146c0
commit
90efce488f
50
Install-Dependencies.ps1
Normal file
50
Install-Dependencies.ps1
Normal file
@ -0,0 +1,50 @@
|
||||
#Requires -RunAsAdministrator
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs prerequisites for SharePoint XLS Converter application
|
||||
#>
|
||||
|
||||
# Enable TLS 1.2 for secure connections
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
Write-Host "Installing required modules..." -ForegroundColor Cyan
|
||||
|
||||
# Install PnP.PowerShell module if not exists
|
||||
if (-not (Get-Module -ListAvailable -Name PnP.PowerShell)) {
|
||||
try {
|
||||
Install-Module PnP.PowerShell -Scope CurrentUser -Force -AllowClobber
|
||||
Write-Host "PnP.PowerShell module installed successfully" -ForegroundColor Green
|
||||
}
|
||||
catch {
|
||||
Write-Host "Failed to install PnP.PowerShell: $_" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "PnP.PowerShell module is already installed" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# Check for Excel installation
|
||||
try {
|
||||
$excelCheck = New-Object -ComObject Excel.Application -ErrorAction Stop
|
||||
$excelCheck.Quit()
|
||||
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($excelCheck) | Out-Null
|
||||
Write-Host "Microsoft Excel is installed" -ForegroundColor Green
|
||||
}
|
||||
catch {
|
||||
Write-Host @"
|
||||
Microsoft Excel not found! The conversion feature requires:
|
||||
1. Microsoft Excel 2013 or newer
|
||||
2. PowerShell must run in STA mode
|
||||
Run the main script like this:
|
||||
powershell.exe -STA -File .\MainForm.ps1
|
||||
"@ -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host @"
|
||||
Installation complete! Run the main application with:
|
||||
powershell.exe -STA -File .\MainForm.ps1
|
||||
|
||||
Note: First run might take longer while modules load
|
||||
"@ -ForegroundColor Green
|
||||
Loading…
Reference in New Issue
Block a user