Source

wpWindowsPowerShell / Microsoft.PowerShell_profile.ps1

Full commit
# Warren's Powershell Profile.  
# Don't forget to do Set-ExecutionPolicy RemoteSigned  
$env:path += ";$profiledir\scripts"

# ----------------------------- BEGIN REGISTRY FUNCTIONS
# Get-RegistryKeyPropertiesAndValues -path 'HKCU:\Software\....'  
Function Get-RegistryKeyPropertiesAndValues
{
  <#
    Get-RegistryKeyPropertiesAndValues -path 'HKCU:\Volatile Environment'
    Http://www.ScriptingGuys.com/blog
  #>

 Param(

  [Parameter(Mandatory=$true)]
  [string]$path)

 Push-Location
 Set-Location -Path $path
 Get-Item . |
 Select-Object -ExpandProperty property |
 ForEach-Object {
 New-Object psobject -Property @{"property"=$_;
    "Value" = (Get-ItemProperty -Path . -Name $_).$_}}
 Pop-Location
} #end function Get-RegistryKeyPropertiesAndValues

# ----------------------------- END REGISTRY FUNCTIONS

new-item -path alias:ABDS5KPM -value "HKLM:\SOFTWARE\Borland\BDS\5.0\Known Packages"
new-item -path alias:ABDS5KPU -value "HKCU:\SOFTWARE\Borland\BDS\5.0\Known Packages"

function reg
{
 $a = get-itemproperty -path $args[0]
 echo $a.psobject.Properties | ?{ $_.Name -eq "(default)" }
}
  #Get-ItemProperty "$ALIAS:ABDS5KPM" | Format-Wide
  
function d2007dfl 
{ cd "$ALIAS:ABDS5KPM" 
  Get-RegistryKeyPropertiesAndValues -path $ALIAS:ABDS5KPM
}

function d2007usr 
{ cd "$ALIAS:ABDS5KPU" 
  Get-RegistryKeyPropertiesAndValues -path $ALIAS:ABDS5KPU
}


new-item -path alias:nppapp -value "C:\Program Files (x86)\Notepad++\notepad++.exe"
function npp1 
 { $a = Resolve-Path($args[0])
   nppapp $a 
 }

function editprofile { npp1 $Profile }

function build { .\build.cmd }

function Get-EventLogAppErrors { Get-EventLog Application  | Where-Object {$_.EntryType -MATCH "Error" } }

function Get-EventLogSysErrors{ Get-EventLog System  | Where-Object {$_.EntryType -MATCH "Error"}  }

# Get-Counter

function ver {  "{0}.{1}" -f $PSVersiontable.PSVersion.Major, $PSVersiontable.PSVersion.Minor }

function profilehelp 
  { write-host "editprofile: edit `$Profile` file "
    write-host "npp1: launch notepad++"
	write-host "rp10wp: move to rentalpoint 10 folder"
	write-host "rp11wp: move to rentalpoint 11 folder"
	write-host "build: run build.cmd in current directory"
  } 

# upload filename ftp://username:password@example.com/pub/incoming/somefilename.zip
function upload
{ 
 Param(
  [Parameter(Mandatory=$true)]
  [string]$File,
  [string]$Ftp
  )
 #File = "D:\outgoing\somefilename.zip"
 #$ftp = "ftp://username:password@example.com/pub/incoming/somefilename.zip"
 "ftp url: $ftp"
 $webclient = New-Object System.Net.WebClient
 $uri = New-Object System.Uri($ftp)
 "Uploading $File..."
 $webclient.UploadFile($uri, $File)
}	


# download filename ftp://username:password@example.com/pub/incoming/somefilename.zip
function download
{ 
 Param(
  [Parameter(Mandatory=$true)]
  [string]$File,
  [string]$Ftp
  )
 #File = "D:\incoming\somefilename.zip"
 #$ftp = "ftp://username:password@example.com/pub/incoming/somefilename.zip"
 "ftp url: $ftp"
 $webclient = New-Object System.Net.WebClient
 $uri = New-Object System.Uri($ftp)
 "Downloading $File..."
 $webclient.DownloadFile($uri, $File)
}	

$profiledir = [system.io.Path]::GetDirectoryName($Profile)

. $profiledir\private.ps1