Skip to content

Instantly share code, notes, and snippets.

@skyhoshi
Created August 12, 2020 17:43
Show Gist options
  • Save skyhoshi/3b40eb26dc0d72d76ce2d2606b32e78a to your computer and use it in GitHub Desktop.
Save skyhoshi/3b40eb26dc0d72d76ce2d2606b32e78a to your computer and use it in GitHub Desktop.
Initialize Powershell Profiles
#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