Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeployPowershellModuleToSystem.ps1
More file actions
Latest commit
40 lines (35 loc) · 1.26 KB
/
Copy pathdeployPowershellModuleToSystem.ps1
File metadata and controls
40 lines (35 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Param(
[switch]
$NoConfirmation,
[switch]
$InstallDebug
)
if($InstallDebug) {
$script:sourcePath= [System.IO.Path]::Combine(
[System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition),
"PowershellScreenManagement\bin\Debug"
)
}
else {
$script:sourcePath= [System.IO.Path]::Combine(
[System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition),
"PowershellScreenManagement\bin\Release"
)
}
$script:destinationPath="C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PowershellScreenManagement"
if( Test-Path$script:destinationPath ) {
Write-Host-ForegroundColor Yellow "Deleting the old module"
Remove-Item$script:destinationPath-Recurse -Confirm:(!$noConfirmation) -ErrorAction Stop -WarningAction Stop
}
if( Test-Path$script:destinationPath ) {
Write-Host-ForegroundColor Red "Deletion of the old module was unsuccessful! Exiting the deployment."
exit(0)
}
if($InstallDebug) {
Write-Host-ForegroundColor Red "Copying the new debug module."
}
else {
Write-Host-ForegroundColor Green "Copying the new release module."
}
Copy-Item"$script:sourcePath"$script:destinationPath-Recurse
Write-Host"You can now use the following command: Import-Module PowershellScreenManagement"