Skip to content

Instantly share code, notes, and snippets.

##AH - AdilHindistan - 2014-04-04
## See bottom for more efficient way to delete dupes
-- Technique to detect duplicate data in rows
select dubCol1,dubCol2,dubCol3,Count(*)
from dupTable
group by dubCol1,dubCol2,dubCol3
having count(*)>1
-- Technique to delete duplicate rows, if there is a column that's unique,
# Download Link:
http://www.microsoft.com/en-us/download/details.aspx?id=42335
These KB's must be installed in the following order: KB2919442, KB2919355, KB2932046, KB2937592, KB2938439, and KB2934018.
KB2919442 is a prerequisite for Windows 8.1 Update and should be installed before attempting to install KB2919355
REM Batch to install
wusa %~dp0Windows8.1-KB2919355-x64.msu /quiet /norestart
wusa %~dp0Windows8.1-KB2932046-x64.msu /quiet /norestart
wusa %~dp0Windows8.1-KB2937592-x64.msu /quiet /norestart
##AH - AdilHindistan - Multi-Threading with PowerShell
Ref: http://bits_video.s3.amazonaws.com/022012-SUPS01_archive.f4v by Tobias Weltner
## Run new thread synchronously
$scriptBlock = {some code here}
$newThread = [Powershell]::Create().AddScript($Code)
$newThread.Invoke() # does not help much, as it stops foreground processing until its job is complete
## Run new thread asynchronously (as if sending a job to the background)
##AH - AdilHindistan - PSMon
#post: http://www.adilhindistan.com/2013/08/work-around-printuidll-quirkiness-on-xp.html
Remove all under
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices\
RegSetValue - Add printers
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices\
HKCU\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts
Detect if an Attribute is Replicated
isMemberOfPartialAttributeSet=TRUE -> Attribute is getting replicated to GC
objectClass=attributeSchema
## Useful Articles
http://www.theidentityguy.com/articles/2010/6/29/figuring-out-whats-in-the-pas.html
http://blogs.technet.com/b/heyscriptingguy/archive/2005/08/22/how-can-i-determine-which-attributes-are-replicated-to-the-global-catalog.aspx
Also see gist: https://gist.github.com/AdilHindistan/9795565
##AH - Adil Hindistan ASP.NET Deep Dive
## Ref: Deep Dive: Improving Performance in Your ASP.NET App
## URL: http://channel9.msdn.com/Events/Build/2014/3-605 by @LeviBroderick
##Turn on OutputCaching
## RAMMFAR
Resides inside Web.Config = RunAllManagedModulesForAllRequests
IIS will run everything by Asp.net runtime (needed for PHP hosting) otherwise it's overhead as it will not serve the content like txt, images etc that IIS can serve without an ASP.NET call first.
Unless needed disable it so that ASP.NET does not intercept 'all' requests.
##AH - AdilHindistan -2014-05-09
##Ref: http://www.howtogeek.com/school/sysinternals-pro/lesson7/
# Get Public IP displayed in BGINFO
Dim o
Set o = CreateObject("MSXML2.XMLHTTP")
o.open "GET", "http://ifconfig.me/ip", False
o.send
echo o.responseText
##AH - AdilHindistan - 2014-05-13
## Registry locs for installed software
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\*
HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*
Products table with entries from these registry keys:
##AH - AdilHindistan - 05/19/2014
ISSUE #1:
SERVER
Cannot Access WSUS Node in mmc:
Causes:
1) Network Services lose access to WSUS Content directory
* Fix by restoring permissions
##AH - AdilHindistan - 2014-05-28
## Delete Group Policy WMI Filters with PowerShell
$wmiFilterAttr = "msWMI-Name", "msWMI-Parm1", "msWMI-Parm2", "msWMI-Author", "msWMI-ID"
H:\> (Get-ADObject -ldapFilter "objectClass=msWMI-Som" -Properties $wmiFilterAttr).where({$_."mswmi-name" -match 'by ws name'})."mswmi-name"
By WS Name 1PARK%
By WS Name 1PK[13579BFJ]%
By WS Name 1PK[2468ACDGHNSV]%
By WS Name CCC1%