Created
August 12, 2020 17:43
-
-
Save skyhoshi/3b40eb26dc0d72d76ce2d2606b32e78a to your computer and use it in GitHub Desktop.
Initialize Powershell Profiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if (!(Test-Path -Path )) | |
if ((Read-Host -Prompt "Initialize Profiles?").ToLower() -contains "y") { | |
$HostFile = $PROFILE.AllUsersAllHosts; | |
if (!(Test-Path -Path $HostFile)) { | |
$CreateHost = Read-Host -Prompt "Would you like to create $HostFile" | |
if ($CreateHost.ToLower() -contains "y") { | |
New-Item -ItemType File -Path $HostFile -Force | |
} | |
$CreateHost = "N"; | |
} | |
$HostFile = $PROFILE.AllUsersCurrentHost; | |
if (!(Test-Path -Path $HostFile)) { | |
$CreateHost = Read-Host -Prompt "Would you like to create $HostFile" | |
if ($CreateHost.ToLower() -contains "y") { | |
New-Item -ItemType File -Path $HostFile -Force | |
} | |
$CreateHost = "N"; | |
} | |
$HostFile = $PROFILE.CurrentUserAllHosts; | |
if (!(Test-Path -Path $HostFile)) { | |
$CreateHost = Read-Host -Prompt "Would you like to create $HostFile" | |
if ($CreateHost.ToLower() -contains "y") { | |
New-Item -ItemType File -Path $HostFile -Force | |
} | |
$CreateHost = "N"; | |
} | |
$HostFile = $PROFILE.CurrentUserCurrentHost; | |
if (!(Test-Path -Path $HostFile)) { | |
$CreateHost = Read-Host -Prompt "Would you like to create $HostFile" | |
if ($CreateHost.ToLower() -contains "y") { | |
New-Item -ItemType File -Path $HostFile -Force | |
} | |
$CreateHost = "N"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment