-
Notifications
You must be signed in to change notification settings - Fork 1
/
INSTALL.ps1
40 lines (33 loc) · 1.4 KB
/
INSTALL.ps1
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
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] “Administrator”))
{
Write-Warning “You do not have required permisions to run this script!`nPlease run Installation script as an Administrator”
Break
}
$Version = "1.0.0"
$ModuleName = "PS.Wiki"
$Description = "Powershell Confluence Automation Module"
$Author = "Håkon Jensen"
$Company = "Sicra AS"
$InstallPath = Join-Path -Path $env:ProgramFiles -ChildPath "WindowsPowerShell\Modules\$($ModuleName)"
$NestedModules = @(
"Confluence.psm1",
"vSphere.psm1",
"Helpers.psm1"
)
#Remove Old FolderStructure
if (Test-Path $InstallPath){
Write-Host "Remove Old Installation Folder"
Remove-Item -Path $InstallPath -Recurse -Force
}
#Create Folder Structure
Write-Host "Create Directory"
mkdir $InstallPath | Out-Null
#Copy Modules
Write-Host "Copy Modules"
Copy-Item $PSScriptRoot\Modules\*.psm1 $InstallPath
#Copy Configuration
Write-Host "Copy Configuration"
Copy-Item "$($PSScriptRoot)\config.xml" $InstallPath\Config.xml
#Create Manifest
Write-Host "Create Manifest"
New-ModuleManifest -Path $InstallPath\$ModuleName.psd1 -ModuleVersion $Version -Description $Description -PowerShellVersion 4.0 -Author $Author -RequiredModules ConfluencePS,VMware.VimAutomation.Core -NestedModules $NestedModules -CompanyName $Company