Skip to content

Instantly share code, notes, and snippets.

#requires -Version 3
#Usage:
#Invoke-command -computername $server -scriptblock {FunctionName -param1 -param2}
# Author: Matt Graeber
# @mattifestation
# www.exploit-monday.com
function Invoke-Command
{
[CmdletBinding(DefaultParameterSetName='InProcess', HelpUri='http://go.microsoft.com/fwlink/?LinkID=135225', RemotingCapability='OwnedByCommand')]
# Make "Disk utility" show hidden partitions:
defaults write com.apple.DiskUtility DUDebugMenuEnabled 1
# Do not create .DS_Store files on network drives:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
# Insert Debug Menu on AppStore
defaults write com.apple.appstore ShowDebugMenu 1
# Then, Start download and then stop install, open the location, and create a hardlink like
# Launch Command Line as 'Administrator'
cd "%ProgramFiles%\\Altiris\Altiris Agent"
regsvr32 AeXAgentDiagnostics.dll
## Resources ## Pro Git Book: http://git-scm.com/book
## Code school: https://www.codeschool.com/courses/try-git
## git stash:
## Sometimes when you go to pull you may have changes you don't want to commit just yet. One option you have, other than committing, is to stash the changes.
## Use the command 'git stash' to stash your changes, and 'git stash apply' to re-apply your changes after your pull.
## -u = remember, remote=origin, branch=master
git push -u origin master
## Get PDC Emulator in PowerShell
## With ADModule
(Get-ADDomain).PDCEmulator
## Without AD Module
$NTDSPDCEmulator = ([adsi]'').fsmoroleowner[0]
$PDCEmulator = ([adsi]"LDAP://$NTDSPDCEmulator").Parent
$PDC = ([adsi]$PDCEmulator).DnsHostName
## Query cim_datafile class to find an executable
# http://msdn.microsoft.com/en-us/library/aa387236(v=vs.85).aspx
get-wmiObject -query "select FileName,Extension,FileSize,Path,CreationDate,InstallDate,LastAccessed from cim_datafile where Drive='d:' AND FileName='powershell' and extension='exe'"
CreationDate : 20130822065947.699027-240
Extension : exe
FileName : powershell
FileSize : 479744
InstallDate : 20130822065947.699027-240
# Microsoft publishes a a spreadsheet that lists the all security bulletins since 1998.
URL: http://www.microsoft.com/en-us/download/details.aspx?id=36982
#AH - AdilHindistan - 2014-02-04
## Enumerate UpdateRelationship values and their meaning with this code:
[System.Enum]::GetValues([Microsoft.UpdateServices.Administration.UpdateRelationship]) | ForEach-Object -Process {
'{0} -> {1}' -f ([Microsoft.UpdateServices.Administration.UpdateRelationship]::$_.Value__),$_
}
# View superseded updates that were previously approved
(Get-WsusServer).SearchUpdates("2010") | Where {
($_.IsSuperseded) -and
# How many jobs we should run simultaneously
$maxConcurrentJobs = 3;
# Read the input and queue it up
$jobInput = get-content .\input.txt
$queue = [System.Collections.Queue]::Synchronized( (New-Object System.Collections.Queue) )
foreach($item in $jobInput)
{
$queue.Enqueue($item)
}
#AH - AdilHindistan - 2014-02-03
## Delete SoftwareDistribution Folder
net stop wuauserv
cmd /c del .\SoftwareDistribution /s /q #PowerShell
net start wuauserv
wuauclt.exe /resetauthorization /detectnow
## Proxy Settings
> reg query "hklm\software\microsoft\windows\currentversion\Internet settings\connections"