-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSet-PsProfile.ps1
More file actions
35 lines (33 loc) · 783 Bytes
/
Set-PsProfile.ps1
File metadata and controls
35 lines (33 loc) · 783 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
26
27
28
29
30
31
32
33
34
function Set-PsProfile {
<#
.SYNOPSIS
Create Powershell user profile
.DESCRIPTION
Create new Powershell user profile and add modules to import
when Powershell starts
.EXAMPLE
Set-PsProfile
notepad $profile
.NOTES
Mark C
https://github.com/i-ScriptALot/PS-Powershell
#>
if (-not (Test-Path $Profile)) {
New-Item $Profile -ItemType File -Force
$Content =
@'
Import-Module 'Path:\Module_1.psm1'
Import-Module 'Path:\Module_2.psm1'
'@
$Content | Add-Content -Path $Profile
if (Test-Path $Profile) {
'Powershell profile created'
}
else {
'Error creating Powershell profile'
}
}
else {
'Powershell profile found. Command not executed'
}
} # End Ps profile function