This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pinvokeCode = @" | |
using System; | |
using System.Runtime.InteropServices; | |
using System.Collections.Generic; | |
namespace Resolution | |
{ | |
[StructLayout(LayoutKind.Sequential)] | |
public struct DEVMODE1 | |
{ | |
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gci *\* | where {$_.PSIsContainer -and $_.CreationTime -lt '2013-01-01T00:00:00'} | %{ write-host $_.FullName; remove-item -recurse $_;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To add more commands, hack them into the $commands array: | |
$commands = @( | |
@{"cmd" = "D:\Documents\Powershell\battwo.bat"; "args" = "yo"}, | |
@{"cmd" = "D:\Documents\Powershell\batone.bat"; "args" = "yo2"} | |
); | |
$jobs = @(); | |
foreach($cmd in $commands) { | |
$startinfo = new-object System.Diagnostics.ProcessStartInfo | |
$startinfo.FileName = $cmd.cmd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on error resume next | |
strComputer=InputBox ("Enter the computer name of the server you'd like to query for the Service Tag:") | |
Set objWMIservice = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") | |
set colitems = objWMIservice.ExecQuery("Select * from Win32_BIOS",,48) | |
For each objitem in colitems | |
Wscript.echo "Dell Service Tag: " & objitem.serialnumber | |
Next |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[[ -n "${1}" ]] && openssl x509 -in <( echo "GET /" | openssl s_client -connect ${1}:443 2>&1 | grep -A 65535 'Server certificate' | tail -n+2 | grep -B 65535 'END CERTIFICATE' ) -noout -text -purpose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import-module SSIS | |
$ssis_package = "D:\MyFile.dtsx"; | |
$package = Get-ISPackage -path $ssis_package; | |
$package.Executables | Where-Object { $_.InnerObject -like 'Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ExecuteSQLTask' } | %{ $fn = $_.Name+".sql"; $_.InnerObject.SqlStatementSource > $fn } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax "ml" ".*\.(xml|xul|rdf|rss|xbl|sgml?)$" | |
color white "^.+$" | |
# Attribute names | |
color brightblue start="<" end=">" | |
# Attribute text | |
color brightgreen ""[^"]+"" | |
# Tag names | |
color brightcyan "<[^> ]+" | |
# Alligators | |
color cyan "<" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo tcpdump -i eth1 -c 100000 -w $(date '+%F_%H-%M-%S').pcap 'tcp port 80' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
db="postgres" | |
psql -qAt -c "SELECT tablename FROM pg_tables WHERE schemaname='public';" $db | while read line; do | |
psql -qAt -c "ANALYZE $line;" $db; | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$connectionString = "Data Source=cidbsql.cwserverfarm.local;Initial Catalog=workdb;Integrated Security=True;Application Name=PowerSheQL"; | |
$SQL = "SELECT TOP 5 * FROM dbo.RE_Trace;"; | |
$dbc = New-Object System.Data.SqlClient.SqlConnection($connectionString); | |
$dbc.Open(); | |
$sqlcmd = $dbc.CreateCommand(); | |
$sqlcmd.CommandTimeout = 1; | |
$sqlcmd.CommandText = $SQL; | |
$sqlcmd.Prepare(); |