-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFunkyStuff.ps1
76 lines (63 loc) · 2.99 KB
/
FunkyStuff.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
param( [Parameter(Mandatory=$true)] $JSONFile)
function DisableFirewallProfiles(){
Set-NetFirewallProfile -Name Private -Enabled False
Set-NetFirewallProfile -Name Public -Enabled False
Set-NetFirewallProfile -Name Domain -Enabled False
}
function DisableMD() {
Set-MpPreference -DisableRealtimeMonitoring $true
}
function CreateLocalUsers(){
param ( [Parameter(Mandatory=$true)] $userObject)
$userName = $userObject.Name
$userDesc = $userObject.Description
$userPass = ConvertTo-SecureString $userObject.password -AsPlainText -Force
New-LocalUser -Name $userName -Description $userDesc -Password $userPass
foreach ($group in $userObject.groups) {
Add-LocalGroupMember -Group $group -Member $userName
}
}
function TaskCreations(){
#schtasks /create /tn whoami /tr "powershell -ExecutionPolicy Bypass -Command ""&" {[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('WHAT IS HAPPENING?!?!','AAAAAAAHHHHHHHH')}"" /sc minute /mo 1 /ru IEUser
$path = $(echo $PWD)
schtasks /create /tn whoami /tr "powershell -ExecutionPolicy Bypass $path\hmm.ps1" /sc minute /mo 1 /ru IEUser
schtasks /create /tn binded /tr "powershell -ExecutionPolicy Bypass $path\bind.ps1" /sc minute /mo 5 /ru IEUser
}
# powershell -ExecutionPolicy Bypass -Command "&" "{[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('WHAT IS HAPPENING?!?!','AAAAAAAHHHHHHHH')}"
# function AnnoyingAlert(){
# #$timeinSec = New-TimeSpan -Seconds 120
# $trigger = New-JobTrigger -Once -At 2:33PM -RepetitionInterval (New-TimeSpan -minutes 2) -RepeatIndefinitely
# Register-ScheduledJob -Name "funky thingies" -Trigger $trigger -ScriptBlock {
# powershell -WindowStyle hidden -Command "& {[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('WHAT IS HAPPENING?!?!','AAAAAAAHHHHHHHH')}"
# }
# #Register-ScheduledJob -Name "funky thingie" -RunEvery $timeinSec -FilePath C:\Users\IEUser\Documents\Scripts\hmm.ps1
# }
function SetMemeAliases()
{
Set-Alias -Name ls -Value "cat" -Option AllScope
Set-Alias -Name cat -Value "dir" -Option AllScope
Export-Alias -Path C:\Aliases.txt
if (!(Test-Path -Path $PROFILE.AllUsersAllHosts)) {
New-Item -ItemType File -Path $PROFILE.AllUsersAllHosts -Force
Get-Content C:\Aliases.txt > $PROFILE.AllUsersAllHosts
}
}
function CreateLocalGroup(){
param ( [Parameter(Mandatory=$true)] $groupObject)
New-LocalGroup -Name $groupObject.Name -Description $groupObject.Description
}
function Main(){
$json = (Get-Content $JSONFile | ConvertFrom-JSON)
$accountGroups = $json.groups
foreach ($group in $accountGroups){
CreateLocalGroup $group
}
foreach ($user in $json.users){
CreateLocalUsers $user
}
DisableMD
DisableFirewallProfiles
TaskCreations
SetMemeAliases
}
Main