Update TGBeta.ps1
This commit is contained in:
22
TGBeta.ps1
22
TGBeta.ps1
@@ -203,7 +203,7 @@ function Install-SVSMSP {
|
||||
)
|
||||
|
||||
function Perform-Cleanup {
|
||||
Write-LogHybrid -Message "Cleanup mode enabled. Starting cleanup process..." -Level "Info" -LogToEvent -EventID 1502
|
||||
Write-LogHybrid -Message "Cleanup mode enabled. Starting cleanup process..." -Level "Info" -LogToEvent
|
||||
|
||||
# Step 1: Remove all old modules
|
||||
Write-LogHybrid -Message "Starting cleanup of old modules..." -Level "Info" -LogToEvent
|
||||
@@ -245,7 +245,7 @@ function Install-SVSMSP {
|
||||
}
|
||||
}
|
||||
|
||||
Write-LogHybrid -Message "Cleanup process completed successfully." -Level "Success" -LogToEvent -EventID 1510
|
||||
Write-LogHybrid -Message "Cleanup process completed successfully." -Level "Success" -LogToEvent
|
||||
}
|
||||
|
||||
function Perform-ToolkitInstallation {
|
||||
@@ -255,26 +255,26 @@ function Install-SVSMSP {
|
||||
# Step 1: Set Execution Policy
|
||||
$localMachineExecutionPolicy = Get-ExecutionPolicy -Scope LocalMachine
|
||||
if ($localMachineExecutionPolicy -ne "RemoteSigned") {
|
||||
Write-LogHybrid -Message "Setting execution policy to RemoteSigned..." -Level "Warning" -LogToEvent -EventID 1522
|
||||
Write-LogHybrid -Message "Setting execution policy to RemoteSigned..." -Level "Warning" -LogToEvent
|
||||
try {
|
||||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force
|
||||
Write-LogHybrid -Message "Execution policy set to RemoteSigned successfully." -Level "Success" -LogToEvent -EventID 1513
|
||||
Write-LogHybrid -Message "Execution policy set to RemoteSigned successfully." -Level "Success" -LogToEvent
|
||||
}
|
||||
catch {
|
||||
Write-LogHybrid -Message "Failed to set execution policy. Error: $_" -Level "Error" -LogToEvent -EventID 1534
|
||||
Write-LogHybrid -Message "Failed to set execution policy. Error: $_" -Level "Error" -LogToEvent
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# Step 2: Ensure NuGet is Installed
|
||||
if (!(Get-PackageProvider -Name "NuGet" -ErrorAction SilentlyContinue)) {
|
||||
Write-LogHybrid -Message "NuGet package provider not found. Installing..." -Level "Warning" -LogToEvent -EventID 1520
|
||||
Write-LogHybrid -Message "NuGet package provider not found. Installing..." -Level "Warning" -LogToEvent
|
||||
try {
|
||||
Install-PackageProvider -Name "NuGet" -Force -Scope AllUsers -Confirm:$false
|
||||
Write-LogHybrid -Message "NuGet package provider installed successfully." -Level "Success" -LogToEvent -EventID 1514
|
||||
Write-LogHybrid -Message "NuGet package provider installed successfully." -Level "Success" -LogToEvent
|
||||
}
|
||||
catch {
|
||||
Write-LogHybrid -Message "Failed to install NuGet package provider. Error: $_" -Level "Error" -LogToEvent -EventID 1535
|
||||
Write-LogHybrid -Message "Failed to install NuGet package provider. Error: $_" -Level "Error" -LogToEvent
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -301,10 +301,10 @@ function Install-SVSMSP {
|
||||
Write-LogHybrid -Message "Failed to install new module '$NewModuleName'. Error: $($_.Exception.Message)" -Level "Error" -LogToEvent
|
||||
}
|
||||
|
||||
Write-LogHybrid -Message "Toolkit installation process completed successfully." -Level "Success" -LogToEvent -EventID 1510
|
||||
Write-LogHybrid -Message "Toolkit installation process completed successfully." -Level "Success" -LogToEvent
|
||||
}
|
||||
|
||||
Write-LogHybrid -Message "Install-SVSMSP function started." -Level "Info" -LogToEvent -EventID 1500
|
||||
Write-LogHybrid -Message "Install-SVSMSP function started." -Level "Info" -LogToEvent
|
||||
|
||||
if ($Cleanup) {
|
||||
Perform-Cleanup
|
||||
@@ -316,7 +316,7 @@ function Install-SVSMSP {
|
||||
return
|
||||
}
|
||||
|
||||
Write-LogHybrid -Message "No specific mode specified. Defaulting to toolkit installation mode..." -Level "Info" -LogToEvent -EventID 1504
|
||||
Write-LogHybrid -Message "No specific mode specified. Defaulting to toolkit installation mode..." -Level "Info" -LogToEvent
|
||||
Perform-ToolkitInstallation
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user