Guest User

PoSH Dump

a guest
Aug 9th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. $Time = (Get-Date).ToString('HH:mm')
  2. $Shell = $Host.UI.RawUI
  3. $ElevationCheck = [bool](([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -match "S-1-5-32-544")
  4. if($ElevationCheck -eq "True"){$Admin = "Admin Enabled"}else{$Admin = "Standard User Shell"}
  5. $Ver = $PSVersionTable.PSVersion
  6. $Major = $Ver.Major
  7. $Minor = $Ver.Minor
  8. $Version = [string]$Major + "." + [string]$Minor
  9.  
  10.  
  11. $Shell.WindowTitle = "$Admin - PoSH $Version - $Time"
  12.  
  13.  
  14.  
  15. Set-Location C:\Code
  16. SET-ALIAS NP -Value C:\Windows\System32\notepad.exe
  17. Set-Alias ON -value "C:\Program Files\Microsoft Office\root\Office16\ONENOTE.EXE"
  18.  
  19.  
  20. Function Get-PublicIP {
  21. $IP = Invoke-WebRequest http://ifconfig.me/ip
  22. Write-Host "Your Public IP Address is $IP"
  23. }
  24.  
  25. function home {
  26. set-location c:\windows\system32
  27. }
  28.  
  29. function XXX {
  30. Shutdown.exe -s -f -t 1
  31. }
  32.  
  33. function ATWS-API {
  34. Write-Host -ForegroundColor YELLOW "Connecting to AutoTask API..."
  35. $Creds = Import-CSV C:\Code\Creds.csv
  36. $Password = $Creds.Password | ConvertTo-SecureString -AsPlainText -Force
  37. $Credential = New-Object System.Management.Automation.PSCredential ($Creds.Username, $Password)
  38.  
  39. Import-Module -Name Autotask
  40. Connect-AtwsWebAPI -Credential $Credential -ApiTrackingIdentifier $Creds.Code -NoDiskCache
  41.  
  42. write-Host -ForegroundColor Green "Connection successful"
  43.  
  44. }
  45.  
  46. $Logger = (Get-Date).ToString('dddd HH-mm')
  47.  
  48. $LogName = $Logger + ".txt"
  49. $FilePath = Join-Path -Path "C:\Code\Logs\Transcript" -ChildPath $Logname
  50.  
  51.  
  52. start-transcript (New-Item -Path $FilePath -ItemType file) -append -noclobber
  53.  
  54. $ps=[PowerShell]::Create()
  55. $ps.AddScript('$null=$host;Get-Variable') > $null
  56. $BuiltIn=$ps.Invoke()
  57. $ps.Runspace.Close()
  58. $ps.Dispose()
  59. $BuiltIn | ForEach-Object { Remove-Variable -Name "$($_.Name)" -ErrorAction SilentlyContinue}
  60.  
  61. Clear-Host
  62.  
  63. if($ElevationCheck -eq "True"){Write-Host -ForegroundColor Green "Shell running as Admin"}else{Write-Host -ForegroundColor Red "Shell running without admin"}
Add Comment
Please, Sign In to add comment