Cum se creează, editeaza și reîncarca un profil cu PowerShell?

Configurare noua (How To)

Situatie

# Check if a profile exists
Test-Path -Path $PROFILE                           # Current User,Current Host  
Test-Path -Path $PROFILE.CurrentUserCurrentHost    # Current User,Current Host  
Test-Path -Path $PROFILE.CurrentUserAllHosts       # Current User,All Hosts    
Test-Path -Path $PROFILE.AllUsersCurrentHost       # All Users, Current Host    
Test-Path -Path $PROFILE.AllUsersAllHosts          # All Users, All Hosts  

Solutie

Pasi de urmat
# Create a new profile for current user
New-Item -ItemType File -Force $PROFILE # CurrentUserCurrentHost
New-Item -ItemType File -Force $PROFILE.CurrentUserCurrentHost
New-Item -ItemType File -Force $PROFILE.CurrentUserAllHosts
# Edit
psEdit $PROFILE (only for ISE)
ise $PROFILE (only for ISE)
notepad.exe $PROFILE
# Reload (without restarting Powershell)
& $PROFILE
.$PROFILE
# List profiles
$PROFILE | Format-List * -Force

Tip solutie

Permanent

Voteaza

(6 din 16 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?