Format:
Recent snippets matching language of PowerShell
Get-MailboxStatistics -server exchange3 | where { $_.DisconnectDate -ne $null } | select DisplayName,Identity,Database | fl
11 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?"
}
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># " }
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)"
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
152 Views
no comments
#!/bin/sh C() { echo $1 } Recursiv() { if test -f $1
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, "")
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
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) {
237 Views
no comments
# ------------------------------------------------------------------------------------------------- # Pinger.ps1 # # 2011-05-25: moved to gist.github.com # https://gist.github.com/992625 # -------------------------------------------------------------------------------------------------
697 Views
no comments
# ------------------------------------------------------------------------------------------------- # InstallUtilPs.ps1 # # Wrapper around InstallUtil.exe. # ------------------------------------------------------------------------------------------------- # Script params param([switch]$u) # uninstall $dotNetRuntimeDir = [System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()
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
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.
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
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}
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
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"
256 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
