My PowerShell profile


Thought I would just share this new version:


Function prompt {


   $windowsIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()


   $windowsPrincipal = new-object ‘System.Security.Principal.WindowsPrincipal’ $windowsIdentity


   $windowTitle = “PowerShell – `”$(get-location)`””


   [bool] $isAdministrator = $windowsPrincipal.IsInRole(“Administrators”) -eq 1


   if ($windowTitle -ne $host.ui.rawui.windowtitle) {


      if ($isAdministrator) {


         $host.UI.RawUI.WindowTitle = “[ADMINISTRATOR] + $windowTitle


      } else {


         $host.UI.RawUI.WindowTitle = $windowTitle


      }


   }


 


  


   Write-Host “$([DateTime]::Now.ToString(‘HH:mm:ss’))” -nonewline -backgroundcolor White -foregroundcolor Black


   Write-Host ‘ ‘ -nonewline


   if ($isAdministrator) {


      Write-Host (“$(get-location)”) -backgroundcolor Red


   } else {


      Write-Host (“$(get-location)”) -backgroundcolor Blue


   }


 


   ‘> ‘


}


 


Function Display-EnvironmentVariable {


   Get-ChildItem ENV: | sort-object -property Name | format-table -autosize


}


 


Function RAlias {


   param([string] $command = $(throw ‘Enter the command to search the alias for’))


   alias | where {$_.Definition -eq “$command”}


}


 


set-alias dev Display-EnvironmentVariable


 


$env:MSSdk = “$env:SystemDrive\Program Files\Microsoft SDKs\Windows\v6.0”


$env:SdkTools =  “$env:MSSdk\Bin”


$env:OSLibraries =  “$env:MSSdk\Lib”


$env:OSIncludes = “$env:MSSdk\Include;$env:MSSdk\Include\gl”


$env:VCTools =  “$env:MSSdk\VC\Bin”


$env:VCLibraries = “$env:MSSdk\VC\Lib”


$env:VCIncludes = “$env:MSSdk\VC\Include;$env:MSSdk\VC\Include\Sys”


$env:ReferenceAssemblies = “$env:ProgramFiles\Reference Assemblies\Microsoft\WinFX\v3.0”


$env:Lib =  “$env:VCLibraries;$env:OSLibraries;$env:Lib”


$env:Include =  “$env:VCIncludes;$env:OSIncludes;$env:Include”


$env:CPU = “i386”


$env:APPVER = “6.0”


$env:TARGETOS = “WINNT”


$env:FxTools=  “$env:windir\Microsoft.NET\Framework\v2.0.50727”


$env:Path = “$env:VCTools;$env:SdkTools;$env:FxTools;$env:SystemDrive\Program Files\Debugging Tools for Windows;$env:Path”


$env:ReferenceAssemblies = “$env:ProgramFiles\Reference Assemblies\Microsoft\WinFX\v3.0”


 

Comments (0)