-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.ps1
More file actions
25 lines (22 loc) · 881 Bytes
/
init.ps1
File metadata and controls
25 lines (22 loc) · 881 Bytes
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
$BaseModules = @{
'Az' = '12.3.0'
'EnterprisePolicyAsCode' = '10.5.8'
}
# set psgallery as trusted
Set-PSRepository -Name 'PSGallery' -InstallationPolicy 'Trusted'
# install each module
foreach ($Module in $BaseModules.GetEnumerator()) {
if ($Module.Value -ieq 'latest') {
Install-Module -Name $Module.Key -AcceptLicense -Repository PSGallery
}
else {
Install-Module -Name $Module.Key -RequiredVersion $Module.Value -AcceptLicense -Repository 'PSGallery'
}
}
# copy ps profile to final location
$ProfilePath = $Profile.Substring(0, $Profile.lastIndexOf('/'))
if (!(Test-Path $ProfilePath)) {
New-Item -Path $ProfilePath -ItemType 'Directory' -Force | Out-Null
}
Copy-Item -Path ./configs/powershell_profile.ps1 -Destination $Profile
Write-Host "Make sure to update the profile to include any module imports"