diff --git a/src/CD_Install.ps1 b/src/CD_Install.ps1 index 62b5674..c0456d8 100644 --- a/src/CD_Install.ps1 +++ b/src/CD_Install.ps1 @@ -1,7 +1,9 @@ # Install ConceptDeploy module for current user -Set-Variable -Name MODULE_NAME -Value 'ConceptDeploy' -Option Constant -$modulePath = "$env:USERPROFILE\Documents\WindowsPowerShell\modules\$MODULE_NAME" +Set-Variable -Name MODULE_NAME -Value 'ConceptDeploy' -Option Constant +$localHome = 'C:\Tools' + +$modulePath = "${localHome}\$MODULE_NAME" if (Test-Path -Path $modulePath) { Remove-Item $modulePath -Recurse -Force } diff --git a/src/ConceptDeploy/ConceptDeploy.psd1 b/src/ConceptDeploy/ConceptDeploy.psd1 index 2287f02..4a86e2d 100644 Binary files a/src/ConceptDeploy/ConceptDeploy.psd1 and b/src/ConceptDeploy/ConceptDeploy.psd1 differ diff --git a/src/DeployServer.ps1 b/src/DeployServer.ps1 index fdb587a..aa80968 100644 --- a/src/DeployServer.ps1 +++ b/src/DeployServer.ps1 @@ -1,4 +1,4 @@ -# Deploy ConceptDeploy module files to server storage +# Deploy ConceptDeploy module files to server storage Set-StrictMode -Version 3.0 Set-Variable -Name MODULE_NAME -Value 'ConceptDeploy' diff --git a/src/InstallAllProducts.ps1 b/src/InstallAllProducts.ps1 index 8e9dbab..f6003ae 100644 --- a/src/InstallAllProducts.ps1 +++ b/src/InstallAllProducts.ps1 @@ -1,4 +1,4 @@ -# Install Concept products from local distr +# Install Concept products from local distr # Setup constants Set-Variable -Name OFFICE_REGISTRY -Value 'HKCU:\SOFTWARE\Microsoft\Office\16.0' -Option Constant @@ -11,6 +11,10 @@ $word = If (Test-Path "${OFFICE_REGISTRY}\Word") {"${OFFICE_REGISTRY}\Word"} Els $excel = If (Test-Path "${OFFICE_REGISTRY}\Excel") {"${OFFICE_REGISTRY}\Excel"} Else {''} $visio = If (Test-Path "${OFFICE_REGISTRY}\Visio") {"${OFFICE_REGISTRY}\Visio"} Else {''} +$desktopPath = [Environment]::GetFolderPath('Desktop') +$localHome = 'C:\Tools' +$Env:PSModulePath += ";${localHome}" + function InstallAllProducts { [CmdletBinding()] Param( @@ -22,8 +26,8 @@ function InstallAllProducts { Set-StrictMode -Version 3.0 - if (-not (Test-Path -Path $distrPath)) { - Write-Error "Distribution path does not exist: $distrPath" + if (-not (Test-Path -Path ${distrPath})) { + Write-Error "Distribution path does not exist: ${distrPath}" Exit 1 } @@ -32,29 +36,28 @@ function InstallAllProducts { StartLog Write-Host "Starting installation procedure for Concept technologies" -ForegroundColor DarkGreen - Write-Host "Sources: $distrPath" - Write-Host "Skip shortcuts: $skipShortcuts`n" + Write-Host "Sources: ${distrPath}" + Write-Host "Skip shortcuts: ${skipShortcuts}`n" Write-Host "Dependencies status:" -ForegroundColor DarkGreen StateSystemStatus $driveLetter = MountPathDrive $distrPath $distr = "${driveLetter}`:" - $localHome = "C:\Tools" Write-Host "`nEnsure core is updated..." -ForegroundColor DarkGreen PrepareCore $distr $distrPath $standalone $localHome - Write-Host "`nSetup SecureLocation options for $SERVER_PATH" -ForegroundColor DarkGreen + Write-Host "`nSetup SecureLocation options for ${SERVER_PATH}" -ForegroundColor DarkGreen SetupTrustedLocations $SERVER_PATH - Write-Host "`nInitializing template path for Office applications: $TEMPLATES_PATH" -ForegroundColor DarkGreen + Write-Host "`nInitializing template path for Office applications: ${TEMPLATES_PATH}" -ForegroundColor DarkGreen InitializeTemplates $TEMPLATES_PATH - Write-Host "Update templates at $TEMPLATES_PATH" -ForegroundColor DarkGreen + Write-Host "Update templates at ${TEMPLATES_PATH}" -ForegroundColor DarkGreen UpdateTemplates "${distr}\data\Templates" $TEMPLATES_PATH $localHome - Copy-Item -Path "$TEMPLATES_PATH\Normal.dotm" -Destination "${TEMPLATES_NORMAL_PATH}\Normal.dotm" - Copy-Item -Path "$TEMPLATES_PATH\NormalEmail.dotm" -Destination "${TEMPLATES_NORMAL_PATH}\NormalEmail.dotm" + Copy-Item -Path "${TEMPLATES_PATH}\Normal.dotm" -Destination "${TEMPLATES_NORMAL_PATH}\Normal.dotm" + Copy-Item -Path "${TEMPLATES_PATH}\NormalEmail.dotm" -Destination "${TEMPLATES_NORMAL_PATH}\NormalEmail.dotm" Write-Host "`nUpdating products..." -ForegroundColor DarkGreen UpdateProducts $distr $TEMPLATES_PATH $localHome @@ -62,8 +65,8 @@ function InstallAllProducts { if (-not ($skipShortcuts)) { Write-Host "`nInstalling desktop shortcuts" -ForegroundColor DarkGreen Copy-Item -Path "${distr}\data\Shortcuts\*" ` - -Destination "$($Env:USERPROFILE)\Desktop\" ` - -Exclude (Get-ChildItem "$($Env:USERPROFILE)\Desktop") -Force -Recurse + -Destination $desktopPath ` + -Exclude (Get-ChildItem $desktopPath) -Force -Recurse } Write-Host "`nClean up procedure ..." -ForegroundColor Blue @@ -139,7 +142,7 @@ function UpdateProducts($distr, $templates, $localHome) { $serverManifest = "${distr}\distribution_manifest.json" $serverJSON = Open-DistrManifest $serverManifest - $localManifest = "C:\Tools\distribution_manifest.json" + $localManifest = "${localHome}\distribution_manifest.json" $localJSON = Open-DistrManifest $localManifest $firstRun = $localJSON.Count -eq 0 diff --git a/src/UninstallConceptProducts.ps1 b/src/UninstallConceptProducts.ps1 index b699844..aa97b6e 100644 --- a/src/UninstallConceptProducts.ps1 +++ b/src/UninstallConceptProducts.ps1 @@ -1,4 +1,8 @@ -# Uninstall Concept products +# Uninstall Concept products + +$localHome = 'C:\Tools' +$desktopPath = [Environment]::GetFolderPath('Desktop') +$Env:PSModulePath += ";${localHome}" function UninstallConceptProducts { [CmdletBinding()] @@ -19,8 +23,6 @@ function UninstallConceptProducts { } Import-Module -Name ConceptDeploy - $localHome = "C:\Tools" - Write-Host "`nRemoving Concept Products" -ForegroundColor DarkGreen $localJSON = Open-DistrManifest "$localHome\distribution_manifest.json" foreach ($product in $localJSON.Keys) { @@ -53,12 +55,12 @@ function UninstallConceptProducts { Write-Host "`nRemoving ConceptDeploy library" -ForegroundColor DarkGreen Remove-Module -Name ConceptDeploy - TryRemove "$env:USERPROFILE\Documents\WindowsPowerShell\modules\ConceptDeploy" + TryRemove "${localHome}\ConceptDeploy" Write-Host "`nRemoving desktop shortcuts" -ForegroundColor DarkGreen - TryRemove "$($Env:USERPROFILE)\Desktop\Everything - поиск по имени.lnk" - TryRemove "$($Env:USERPROFILE)\Desktop\DocFetcher - поиск по содержимому.lnk" - TryRemove "$($Env:USERPROFILE)\Desktop\Double Commander.lnk" + TryRemove "${desktopPath}\Everything - поиск по имени.lnk" + TryRemove "${desktopPath}\DocFetcher - поиск по содержимому.lnk" + TryRemove "${desktopPath}\Double Commander.lnk" Write-Host "`nUninstallation complete" -ForegroundColor Green @@ -71,7 +73,7 @@ function StartLog { $ErrorActionPreference = "Continue" $dateSuffix = (Get-Date -UFormat "%Y%m%d_%I-%M-%S").ToString() - $logFile = "$PSScriptRoot\logs\$($dateSuffix)_CP-uninstall_$($Env:USERNAME).txt" + $logFile = "${PSScriptRoot}\logs\$($dateSuffix)_CP-uninstall_$($Env:USERNAME).txt" Start-Transcript -Path $logFile -IncludeInvocationHeader } diff --git a/src/UpdateConceptProducts.ps1 b/src/UpdateConceptProducts.ps1 index 2fd3772..51d5395 100644 --- a/src/UpdateConceptProducts.ps1 +++ b/src/UpdateConceptProducts.ps1 @@ -1,4 +1,8 @@ -# Install Concept products from local distr +# Install Concept products from local distr + + +$localHome = 'C:\Tools' +$Env:PSModulePath += ";${localHome}" function UpdateConceptProducts { [CmdletBinding()] @@ -18,8 +22,8 @@ function UpdateConceptProducts { StartLog Write-Host "Starting update procedure for Concept technologies" -ForegroundColor DarkGreen - Write-Host "Sources: $distrPath" - Write-Host "Requested products: $products" + Write-Host "Sources: ${distrPath}" + Write-Host "Requested products: ${products}" $updates = New-Object System.Collections.Generic.List[System.Object] $enable_products = New-Object System.Collections.Generic.List[System.Object] @@ -99,6 +103,7 @@ function UpdateProducts($distrPath, $products) { Write-Host "Installing Powershell library: ConceptDeploy" -ForegroundColor DarkGreen . "$driveLetter\src\ConceptDeploy\CD_Install.ps1" } + Import-Module -Name ConceptDeploy Write-Host "Using ConceptDeploy: $((Get-Module -Name 'ConceptDeploy').Version)" -ForegroundColor Gray diff --git a/src/VERSION b/src/VERSION index a0cd9f0..a4f52a5 100644 --- a/src/VERSION +++ b/src/VERSION @@ -1 +1 @@ -3.1.0 \ No newline at end of file +3.2.0 \ No newline at end of file