Skip to content

Instantly share code, notes, and snippets.

View jetstreamin's full-sized avatar
:octocat:
chillin' like the vanilla shake that I am

Mike Mahon jetstreamin

:octocat:
chillin' like the vanilla shake that I am
View GitHub Profile
:: http://technet.microsoft.com/en-us/library/bb490894.aspx
:: F7 = history
:: Alt+F7 = history -c
:: F8 = Ctrl+R
:: Use & to run multiple commands e.g.: command1 & command2
:: Add this file as a REG_SZ/REG_EXPAND_SZ registry variables in HKEY_LOCAL_MACHINE\Software\Microsoft\Command or Processor\AutoRun HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
@echo off
:: Linux commands
doskey alias = doskey $*
@jetstreamin
jetstreamin / appcmd-command-ref
Created July 8, 2015 20:02
appcmd most common commands
1. Add Site
appcmd add site /name:MySite /bindings:http://*:80 /physicalpath:”d:\MySitePath”
2. Add App Pool
appcmd add apppool /name:MyAppPool /managedRuntimeVersion:v4.0 (e.g. targeting .NET 4.0)
3. Set App Pool Credential
appcmd set config /section:applicationPools /[name='MyAppPool'].processModel.identityType:SpecificUser /[name='MyAppPool'].processModel.userName:MyDomain\MyAccount /[name='MyAppPool'].processModel.password:MyAccountPassword
4.Add App
appcmd add app /site.name:"MySite" /path:/MyApp /physicalpath:"d:\MySitePath\MyApp"
5. Assign/Change App Pool to an App
@jetstreamin
jetstreamin / sqlcmd options
Created July 9, 2015 12:16
sqlcmd options
sqlcmd
-a packet_size
-A (dedicated administrator connection)
-b (terminate batch job if there is an error)
-c batch_terminator
-C (trust the server certificate)
-d db_name
-e (echo input)
-E (use trusted connection)
-f codepage | i:codepage[,o:codepage] | o:codepage[,i:codepage]
@jetstreamin
jetstreamin / SQL - Common Table Expression - CTE
Created July 9, 2015 17:13
SQL - Common Table Expression - CTE
WITH expression_name [ ( column_name [,...n] ) ]
AS
( CTE_query_definition )
@jetstreamin
jetstreamin / SQL - View Extended Properties
Created July 9, 2015 17:14
SQL - View Extended Properties
USE AdventureWorks2008R2;
GO
SELECT objtype, objname, name, value
FROM fn_listextendedproperty(default, default, default, default, default, default, default);
GO
@jetstreamin
jetstreamin / Arguments from Batch to PowerShell
Created July 9, 2015 17:15
Passing Arguments from Batch to PowerShell
powershell -command "G:\Karan\PowerShell_Scripts\START_DEV.ps1 Dev"
and inside your script head:
$w=$args[0]
This if you want to use the built-in variable $args. Otherwise:
powershell -command "G:\Karan\PowerShell_Scripts\START_DEV.ps1 -w \"Dev\""
@jetstreamin
jetstreamin / PowerShell in a Batch File
Created July 9, 2015 17:17
PowerShell in a Batch File
code = {
#iterate numbers 1 through 10
1..10 | foreach-object {
# just output them
"Current output:"
$_
}
}
Then use this PowerShell command to get the encoded version:
Syntax
findstr [/b] [/e] [/l] [/r] [/s] [/i] [/x] [/v] [/n] [/m] [/o] [/p] [/offline] [/g:file] [/f:file] [/c:string] [/d:dirlist] [/a:ColorAttribute] [strings] [[Drive:][Path] FileName [...]]
Top of page
Parameters
/b : Matches the pattern if at the beginning of a line.
/e : Matches the pattern if at the end of a line.
/l : Uses search strings literally.
/r : Uses search strings as regular expressions. Findstr interprets all metacharacters as regular expressions unless you use /l.
/s : Searches for matching files in the current directory and all subdirectories.
/i : Specifies that the search is not to be case-sensitive.