CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching language of PowerShell
Get-MailboxStatistics -server exchange3 | where { $_.DisconnectDate -ne $null } | select DisplayName,Identity,Database | fl
Thursday @ 12:27pm
Tags:
11 Views
no comments
 
emvase y embalaje de invesca
Monday @ 6:04pm
16 Views
no comments
 
 
$longRunningScript = {
    "Asking for input:"
 
    $foo = [system.console]::ReadLine()
 
    "We shouldn't see this text - because why would a job type {Enter} at the prompt?"
}
 
by Staxmanade   December 10, 2011 @ 4:09pm
Tags:
64 Views
no comments
 
$isAdmin = !(($env:SESSIONNAME).Length -gt 0)
 
function Prompt
{
  $pwd = $(get-location)
  if ($isAdmin)
  {
    $host.ui.RawUI.WindowTitle = "Administrator: $pwd"
    "PS $pwd># "    
  }
by Matthew Flaschen   October 18, 2011 @ 6:09pm
49 Views
no comments
 
$AlbumToStartWithPath = "C:\Users\Spade\documents\visual studio 2010\Projects\AlbumToStartWith\"
 
$InterfacesDLL = "AlbumToStartWith.BLL.Interfaces\bin\Debug\AlbumToStartWith.BLL.Interfaces.dll"
$ServicesDLL = "AlbumToStartWith.BLL.Services\bin\Debug\AlbumToStartWith.BLL.Services.dll"
$NewtonsoftJsonDLL = "packages\Newtonsoft.Json.4.0.2\lib\net40\Newtonsoft.Json.dll"
$HammockDLL = "packages\Hammock.1.2.6\lib\4.0\Hammock.ClientProfile.dll"
$EMusicClientDLL = "AlbumToStartWith.ExternalClients.EMusic\bin\Debug\AlbumToStartWith.ExternalClients.EMusic.dll"
 
Add-Type -Path "$($AlbumToStartWithPath)$($InterfacesDLL)"
Add-Type -Path "$($AlbumToStartWithPath)$($ServicesDLL)"
by Stanley.Goldman   September 21, 2011 @ 11:24am
Tags:
35 Views
no comments
 
# SetVersion.ps1
#
# Set the version in all the AssemblyInfo.cs or AssemblyInfo.vb files in any subdirectory.
#
# usage:  
#  from cmd.exe: 
#     powershell.exe SetVersion.ps1  2.8.3.0
# 
#  from powershell.exe prompt: 
#     .\SetVersion.ps1  2.8.3.0
by Robert.Eberhart   March 30, 2011 @ 5:22pm
Tags:
152 Views
no comments
 
#!/bin/sh
C()
{
  echo $1
}
 
 
Recursiv()
{
   if test -f $1
by Code4Fun   March 15, 2011 @ 11:51pm
Tags:
67 Views
no comments
 
#requires get-interface from http://www.nivot.org/2009/03/26/PowerShell20CTP3ModulesInPracticeNETInterfaces.aspx
# this needs to be program files x86 if in 64 bit context
$runtimeDir="$($env:ProgramFiles)\Inishtech SLP Code Protector"
add-type -path "$runtimeDir\Microsoft.Licensing.Runtime2.0.DLL"
#NB if you leave this empty, you'll only see the memory store
$shortCode = "abc12"
$r = new-object Microsoft.Licensing.SLMRuntime $shortCode
$ls = get-interface $r.LicenseStores ([Microsoft.Licensing.ISLMLicenseStores])
$localStores=$ls.MachineStore
$localStores | %{get-interface $_ ([Microsoft.Licensing.ILicenseStore])}
119 Views
no comments
 
#http://www.nivot.org/2009/03/26/PowerShell20CTP3ModulesInPracticeNETInterfaces.aspx
 
function Get-Interface {
 
#.Synopsis
#   Allows PowerShell to call specific interface implementations on any .NET object. 
#.Description
#   Allows PowerShell to call specific interface implementations on any .NET object. 
#
#   As of v2.0, PowerShell cannot cast .NET instances to a particular interface. This makes it
286 Views
no comments
 
#requires get-interface from http://www.nivot.org/2009/03/26/PowerShell20CTP3ModulesInPracticeNETInterfaces.aspx
# this needs to be program files x86 if in 64 bit context
$runtimeDir="$env:ProgramFiles\Inishtech SLP Code Protector"
add-type -path "$runtimeDir\Microsoft.Licensing.Runtime2.0.DLL"
$shortCode = "abc12"
$r = new-object Microsoft.Licensing.SLMRuntime $shortCode
$a = get-interface $r.Activation ([Microsoft.Licensing.ISLMActivation])
$ac = get-interface $a.CreateActivationClient("Product","1.0") ([Microsoft.Licensing.IActivationClient])
$activationKey="29KV3-E4T9M-WDTTD-KNVZB-YUVZZ"
$ac.Activate( $activationKey, "") 
by InishTech   February 17, 2011 @ 4:24pm
153 Views
no comments
 
 
 
$dbDir = "C:\Dev\MyProject\branches\1.0.0\src\Database\"
$viewsDir = [IO.Path]::Combine($dbDir, "Views")
$functionsDir = [IO.Path]::Combine($dbDir, "Functions")
$sprocsDir = [IO.Path]::Combine($dbDir, "Stored Procedures")
$dbServer = "(local)\SQL2k8"
 
#Write-Host $dbDir
#Write-Host $viewsDir
by Jon Sagara   December 27, 2010 @ 5:43pm
147 Views
no comments
 
$newVirtualDirectory = $args[0]
$physicalPath = $args[1]
 
# gets the IIS root object
$iis = [ADSI]"IIS://localhost/w3svc/1/root"
 
$vdir = $iis.psbase.children | where {$_.AppRoot -eq ('/LM/W3SVC/1/Root/' + $newVirtualDirectory)}
 
# Check to see if the virtual directory exists
if (!$vdir) {
by Robert.Eberhart   December 20, 2010 @ 6:52am
237 Views
no comments
 
# -------------------------------------------------------------------------------------------------
# Pinger.ps1
#
# 2011-05-25: moved to gist.github.com
# https://gist.github.com/992625
# -------------------------------------------------------------------------------------------------
by Jon Sagara   December 13, 2010 @ 2:53pm
697 Views
no comments
 
# -------------------------------------------------------------------------------------------------
# InstallUtilPs.ps1
#
# Wrapper around InstallUtil.exe.
# -------------------------------------------------------------------------------------------------
 
# Script params
param([switch]$u) # uninstall
 
$dotNetRuntimeDir = [System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()
by Jon Sagara   December 13, 2010 @ 2:50pm
262 Views
no comments
 
make
g++ -c -pipe -O2 -D_REENTRANT -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_SVG_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSvg -I/usr/include/qt4/QtSvg -I/usr/include/qt4/QtWebKit -I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -I. -I. -o CutyCapt.o CutyCapt.cpp
/usr/bin/moc-qt4 -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_SVG_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSvg -I/usr/include/qt4/QtSvg -I/usr/include/qt4/QtWebKit -I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -I. -I. CutyCapt.hpp -o moc_CutyCapt.cpp
g++ -c -pipe -O2 -D_REENTRANT -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_SVG_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSvg -I/usr/include/qt4/QtSvg -I/usr/include/qt4/QtWebKit -I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -I. -I. -o moc_CutyCapt.o moc_CutyCapt.cpp
g++  -o CutyCapt CutyCapt.o moc_CutyCapt.o    -L/usr/lib -lQtWebKit -lQtSvg -lQtGui -lQtNetwork -lQtCore -lpthread
by benbois   December 11, 2010 @ 5:39am
Tags:
179 Views
no comments
 
sudo dpkg -i Downloads/OOo4Kids-debian-menus_1.1-11_all.deb 
[sudo] password for user: 
Selecting previously deselected package ooo4kids-debian-menus.
(Reading database ... 194838 files and directories currently installed.)
Unpacking ooo4kids-debian-menus (from .../OOo4Kids-debian-menus_1.1-11_all.deb) ...
Setting up ooo4kids-debian-menus (1.1-11) ...
/usr/bin/gtk-update-icon-cache
gtk-update-icon-cache: Cache file created successfully.
/usr/bin/gtk-update-icon-cache
gtk-update-icon-cache: Cache file created successfully.
by benbois   December 01, 2010 @ 11:50pm
Tags:
106 Views
no comments
 
function hgstat
{
  gci -r -fi .hg |% { 
  
    $repo = $_.FullName.Substring(0,$_.FullName.Length-3); 
    
    Write-Host("[" + $repo + "]") -nonewline -foregroundcolor White
    
    $result = hg out -R $repo --template '*' 2> $null
    
by Andy Sherwood   November 08, 2010 @ 4:59pm
Tags:
107 Views
no comments
 
Get-ChildItem *.js -Recurse -Path "d:\Projects\trunk\src\" | ForEach-Object {
$content = $_ | Get-Content
Set-Content -PassThru $_.Fullname $content -Encoding UTF8 -Force}
by ZStyle   October 27, 2010 @ 12:36am
153 Views
no comments
 
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC>wsdl /language:VB /sharetypes http://algbbwin700/WebServices-2/Common.asmx http://algbbwin700/WebServices-2/Comail.asmx http://algbbwin700/WebServices-2/DSMS.asmx /out:WebServices2.vb /n:WebServices2
by Viktar   August 10, 2010 @ 6:52am
Tags:
133 Views
no comments
 
To Encrypt, run the following from the Visual Studio command prompt:
 
  aspnet_regiis -pe "connectionStrings" -app "/AppName" -prov "RsaProtectedConfigurationProvider"
 
To Decrypt, run the following from the Visual Studio command prompt:
 
  aspnet_regiis -pd "connectionStrings" -app "/AppName"
 
by Al Gonzalez   July 12, 2010 @ 4:39pm
256 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate