Compare commits
65 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ade64d6c0a | ||
|
|
8204bdfc5f | ||
|
|
1a9bb3e986 | ||
|
|
49356479e5 | ||
|
|
c44e9a7292 | ||
|
|
21771a593f | ||
|
|
84458dfc4c | ||
|
|
5835632dab | ||
|
|
67aa7229ef | ||
|
|
b72dc3ed3a | ||
|
|
0f93d4a5bd | ||
|
|
106320b035 | ||
|
|
63951705cd | ||
|
|
a8d56921d5 | ||
|
|
10bc133cf1 | ||
|
|
adeb5b35c9 | ||
|
|
589ff46ea5 | ||
|
|
656fcb9fe7 | ||
|
|
1cb9353006 | ||
|
|
57bf16ba07 | ||
|
|
659846ed88 | ||
|
|
25894044e0 | ||
|
|
e7a0826beb | ||
|
|
1f7ddee23b | ||
|
|
7e186730db | ||
|
|
6713a50208 | ||
|
|
7c9d8fcfec | ||
|
|
33bfc8cfe8 | ||
|
|
ca735bc14a | ||
|
|
4ba748a18b | ||
|
|
f1845106f8 | ||
|
|
67e7156c4b | ||
|
|
4a476adebf | ||
|
|
918798f8cc | ||
|
|
5a3f868866 | ||
|
|
feea2c6396 | ||
|
|
707b4c46d9 | ||
|
|
89ca39fc2b | ||
|
|
204281b12d | ||
|
|
a8538a7e95 | ||
|
|
dee1b471e9 | ||
|
|
aa04e9b01f | ||
|
|
350f0dc604 | ||
|
|
6021f2efd6 | ||
|
|
51838ec25a | ||
|
|
54768a121e | ||
|
|
8ff72cdca3 | ||
|
|
2cb53ad06b | ||
|
|
b8349de31d | ||
|
|
d7e11af7f8 | ||
|
|
dd8d39e698 | ||
|
|
afb1316daa | ||
|
|
04d7017536 | ||
|
|
6a1c75b060 | ||
|
|
5c94611f3b | ||
|
|
4e5676e80f | ||
|
|
c96d688a9c | ||
|
|
804242e9a5 | ||
|
|
0ec9760b17 | ||
|
|
d481ae3da4 | ||
|
|
4742c14fc1 | ||
|
|
509b0d501b | ||
|
|
d4c9b04d4e | ||
|
|
16fb4d331b | ||
|
|
e9e5bf31a7 |
@@ -20,7 +20,7 @@ from tacticalrmm.utils import run_nats_api_cmd
|
||||
logger.configure(**settings.LOG_CONFIG)
|
||||
|
||||
|
||||
def agent_update(pk: int, codesigntoken: str = None) -> str:
|
||||
def agent_update(pk: int, codesigntoken: str = None, force: bool = False) -> str:
|
||||
from agents.utils import get_exegen_url
|
||||
|
||||
agent = Agent.objects.get(pk=pk)
|
||||
@@ -45,22 +45,23 @@ def agent_update(pk: int, codesigntoken: str = None) -> str:
|
||||
else:
|
||||
url = agent.winagent_dl
|
||||
|
||||
if agent.pendingactions.filter(
|
||||
action_type="agentupdate", status="pending"
|
||||
).exists():
|
||||
agent.pendingactions.filter(
|
||||
if not force:
|
||||
if agent.pendingactions.filter(
|
||||
action_type="agentupdate", status="pending"
|
||||
).delete()
|
||||
).exists():
|
||||
agent.pendingactions.filter(
|
||||
action_type="agentupdate", status="pending"
|
||||
).delete()
|
||||
|
||||
PendingAction.objects.create(
|
||||
agent=agent,
|
||||
action_type="agentupdate",
|
||||
details={
|
||||
"url": url,
|
||||
"version": version,
|
||||
"inno": inno,
|
||||
},
|
||||
)
|
||||
PendingAction.objects.create(
|
||||
agent=agent,
|
||||
action_type="agentupdate",
|
||||
details={
|
||||
"url": url,
|
||||
"version": version,
|
||||
"inno": inno,
|
||||
},
|
||||
)
|
||||
|
||||
nats_data = {
|
||||
"func": "agentupdate",
|
||||
@@ -74,6 +75,21 @@ def agent_update(pk: int, codesigntoken: str = None) -> str:
|
||||
return "created"
|
||||
|
||||
|
||||
@app.task
|
||||
def force_code_sign(pks: list[int]) -> None:
|
||||
try:
|
||||
token = CodeSignToken.objects.first().token
|
||||
except:
|
||||
return
|
||||
|
||||
chunks = (pks[i : i + 50] for i in range(0, len(pks), 50))
|
||||
for chunk in chunks:
|
||||
for pk in chunk:
|
||||
agent_update(pk=pk, codesigntoken=token, force=True)
|
||||
sleep(0.05)
|
||||
sleep(4)
|
||||
|
||||
|
||||
@app.task
|
||||
def send_agent_update_task(pks: list[int]) -> None:
|
||||
try:
|
||||
|
||||
@@ -152,8 +152,9 @@ class TestAgentViews(TacticalTestCase):
|
||||
|
||||
self.check_not_authenticated("post", url)
|
||||
|
||||
@patch("time.sleep")
|
||||
@patch("agents.models.Agent.nats_cmd")
|
||||
def test_ping(self, nats_cmd):
|
||||
def test_ping(self, nats_cmd, mock_sleep):
|
||||
url = f"/agents/{self.agent.pk}/ping/"
|
||||
|
||||
nats_cmd.return_value = "timeout"
|
||||
|
||||
@@ -3,6 +3,7 @@ import datetime as dt
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
import time
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse
|
||||
@@ -65,9 +66,18 @@ def update_agents(request):
|
||||
def ping(request, pk):
|
||||
agent = get_object_or_404(Agent, pk=pk)
|
||||
status = "offline"
|
||||
r = asyncio.run(agent.nats_cmd({"func": "ping"}, timeout=5))
|
||||
if r == "pong":
|
||||
status = "online"
|
||||
attempts = 0
|
||||
while 1:
|
||||
r = asyncio.run(agent.nats_cmd({"func": "ping"}, timeout=2))
|
||||
if r == "pong":
|
||||
status = "online"
|
||||
break
|
||||
else:
|
||||
attempts += 1
|
||||
time.sleep(1)
|
||||
|
||||
if attempts >= 5:
|
||||
break
|
||||
|
||||
return Response({"name": agent.hostname, "status": status})
|
||||
|
||||
|
||||
@@ -430,11 +430,12 @@ class Policy(BaseAuditModel):
|
||||
|
||||
# remove policy checks from agent that fell out of policy scope
|
||||
agent.agentchecks.filter(
|
||||
managed_by_policy=True,
|
||||
parent_check__in=[
|
||||
checkpk
|
||||
for checkpk in agent_checks_parent_pks
|
||||
if checkpk not in [check.pk for check in final_list]
|
||||
]
|
||||
],
|
||||
).delete()
|
||||
|
||||
return [
|
||||
|
||||
@@ -171,6 +171,7 @@ class TestAutotaskViews(TacticalTestCase):
|
||||
url = f"/tasks/{policy_task.id}/automatedtasks/" # type: ignore
|
||||
resp = self.client.delete(url, format="json")
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
self.assertFalse(AutomatedTask.objects.filter(pk=policy_task.id)) # type: ignore
|
||||
delete_policy_autotasks_task.assert_called_with(task=policy_task.id) # type: ignore
|
||||
|
||||
self.check_not_authenticated("delete", url)
|
||||
|
||||
@@ -4,6 +4,7 @@ import os
|
||||
import string
|
||||
from statistics import mean
|
||||
from typing import Any
|
||||
from packaging import version as pyver
|
||||
|
||||
import pytz
|
||||
from alerts.models import SEVERITY_CHOICES
|
||||
@@ -421,16 +422,20 @@ class Check(BaseAuditModel):
|
||||
|
||||
# ping checks
|
||||
elif self.check_type == "ping":
|
||||
success = ["Reply", "bytes", "time", "TTL"]
|
||||
output = data["output"]
|
||||
|
||||
if data["has_stdout"]:
|
||||
if all(x in output for x in success):
|
||||
self.status = "passing"
|
||||
else:
|
||||
if pyver.parse(self.agent.version) <= pyver.parse("1.5.2"):
|
||||
# DEPRECATED
|
||||
success = ["Reply", "bytes", "time", "TTL"]
|
||||
if data["has_stdout"]:
|
||||
if all(x in output for x in success):
|
||||
self.status = "passing"
|
||||
else:
|
||||
self.status = "failing"
|
||||
elif data["has_stderr"]:
|
||||
self.status = "failing"
|
||||
elif data["has_stderr"]:
|
||||
self.status = "failing"
|
||||
else:
|
||||
self.status = data["status"]
|
||||
|
||||
self.more_info = output
|
||||
self.save(update_fields=["more_info"])
|
||||
|
||||
@@ -123,11 +123,12 @@ class GetUpdateDeleteCheck(APIView):
|
||||
from automation.tasks import generate_agent_checks_task
|
||||
|
||||
check = get_object_or_404(Check, pk=pk)
|
||||
|
||||
check.delete()
|
||||
|
||||
# Policy check deleted
|
||||
if check.policy:
|
||||
Check.objects.filter(parent_check=check.pk).delete()
|
||||
Check.objects.filter(managed_by_policy=True, parent_check=pk).delete()
|
||||
|
||||
# Re-evaluate agent checks is policy was enforced
|
||||
if check.policy.enforced:
|
||||
|
||||
@@ -62,9 +62,12 @@ def version(request):
|
||||
|
||||
@api_view()
|
||||
def dashboard_info(request):
|
||||
from tacticalrmm.utils import get_latest_trmm_ver
|
||||
|
||||
return Response(
|
||||
{
|
||||
"trmm_version": settings.TRMM_VERSION,
|
||||
"latest_trmm_ver": get_latest_trmm_ver(),
|
||||
"dark_mode": request.user.dark_mode,
|
||||
"show_community_scripts": request.user.show_community_scripts,
|
||||
"dbl_click_action": request.user.agent_dblclick_action,
|
||||
@@ -231,6 +234,23 @@ class CodeSign(APIView):
|
||||
ret = "Something went wrong"
|
||||
return notify_error(ret)
|
||||
|
||||
def post(self, request):
|
||||
from agents.models import Agent
|
||||
from agents.tasks import force_code_sign
|
||||
|
||||
err = "A valid token must be saved first"
|
||||
try:
|
||||
t = CodeSignToken.objects.first().token
|
||||
except:
|
||||
return notify_error(err)
|
||||
|
||||
if t is None or t == "":
|
||||
return notify_error(err)
|
||||
|
||||
pks: list[int] = list(Agent.objects.only("pk").values_list("pk", flat=True))
|
||||
force_code_sign.delay(pks=pks)
|
||||
return Response("Agents will be code signed shortly")
|
||||
|
||||
|
||||
class GetAddKeyStore(APIView):
|
||||
def get(self, request):
|
||||
|
||||
@@ -7,7 +7,7 @@ channels==3.0.3
|
||||
chardet==4.0.0
|
||||
cryptography==3.4.7
|
||||
daphne==3.0.2
|
||||
Django==3.2.0
|
||||
Django==3.2.1
|
||||
django-cors-headers==3.7.0
|
||||
django-rest-knox==4.1.0
|
||||
djangorestframework==3.12.4
|
||||
@@ -27,7 +27,7 @@ redis==3.5.3
|
||||
requests==2.25.1
|
||||
six==1.15.0
|
||||
sqlparse==0.4.1
|
||||
twilio==6.56.0
|
||||
twilio==6.57.0
|
||||
urllib3==1.26.4
|
||||
uWSGI==2.0.19.1
|
||||
validators==0.18.2
|
||||
|
||||
@@ -405,6 +405,8 @@
|
||||
"args": [
|
||||
"-serviceName {{client.ScreenConnectService}}",
|
||||
"-url {{client.ScreenConnectInstaller}}",
|
||||
"-clientname {{client.name}}",
|
||||
"-sitename {{site.name}}",
|
||||
"-action install"
|
||||
],
|
||||
"default_timeout": "90",
|
||||
@@ -481,6 +483,16 @@
|
||||
"category": "TRMM (Win):Network",
|
||||
"default_timeout": "90"
|
||||
},
|
||||
{
|
||||
"guid": "0caa33bc-89ca-47e0-ad4a-04626ae6384d",
|
||||
"filename": "Win_Network_TCP_Reset_Stack.bat",
|
||||
"submittedBy": "https://github.com/silversword411",
|
||||
"name": "Network - Reset tcp using netsh",
|
||||
"description": "resets tcp stack using netsh",
|
||||
"shell": "cmd",
|
||||
"category": "TRMM (Win):Network",
|
||||
"default_timeout": "120"
|
||||
},
|
||||
{
|
||||
"guid": "6ce5682a-49db-4c0b-9417-609cf905ac43",
|
||||
"filename": "Win_Win10_Change_Key_and_Activate.ps1",
|
||||
@@ -599,5 +611,35 @@
|
||||
"description": "Add a task to Task Scheduler, needs editing",
|
||||
"shell": "powershell",
|
||||
"category": "TRMM (Win):Other"
|
||||
},
|
||||
{
|
||||
"guid": "e371f1c6-0dd9-44de-824c-a17e1ca4c4ab",
|
||||
"filename": "Win_Outlook_SentItems_To_Delegated_Folders.ps1",
|
||||
"submittedBy": "https://github.com/dinger1986",
|
||||
"name": "Outlook - Delegated folders set for all profiles",
|
||||
"description": "Uses RunAsUser to setup sent items for the currently logged on user on delegated folders to go into the delegated folders sent for all.",
|
||||
"shell": "powershell",
|
||||
"category": "TRMM (Win):Office",
|
||||
"default_timeout": "90"
|
||||
},
|
||||
{
|
||||
"guid": "17040742-184a-4251-8f7b-4a1b0a1f02d1",
|
||||
"filename": "Win_File_Copy_Misc.ps1",
|
||||
"submittedBy": "https://github.com/tremor021",
|
||||
"name": "EXAMPLE File Copying using powershell",
|
||||
"description": "Reference Script: Will need manual tweaking, for copying files/folders from paths/websites to local",
|
||||
"shell": "powershell",
|
||||
"category": "TRMM (Win):Misc>Reference",
|
||||
"default_timeout": "1"
|
||||
},
|
||||
{
|
||||
"guid": "168037d8-78e6-4a6a-a9a9-8ec2c1dbe949",
|
||||
"filename": "Win_MSI_Install.ps1",
|
||||
"submittedBy": "https://github.com/silversword411",
|
||||
"name": "EXAMPLE Function for running MSI install via powershell",
|
||||
"description": "Reference Script: Will need manual tweaking, for running MSI from powershell",
|
||||
"shell": "powershell",
|
||||
"category": "TRMM (Win):Misc>Reference",
|
||||
"default_timeout": "1"
|
||||
}
|
||||
]
|
||||
@@ -15,20 +15,23 @@ EXE_DIR = os.path.join(BASE_DIR, "tacticalrmm/private/exe")
|
||||
AUTH_USER_MODEL = "accounts.User"
|
||||
|
||||
# latest release
|
||||
TRMM_VERSION = "0.6.5"
|
||||
TRMM_VERSION = "0.6.8"
|
||||
|
||||
# bump this version everytime vue code is changed
|
||||
# to alert user they need to manually refresh their browser
|
||||
APP_VER = "0.0.132"
|
||||
APP_VER = "0.0.134"
|
||||
|
||||
# https://github.com/wh1te909/rmmagent
|
||||
LATEST_AGENT_VER = "1.5.2"
|
||||
LATEST_AGENT_VER = "1.5.5"
|
||||
|
||||
MESH_VER = "0.8.19"
|
||||
|
||||
# for the update script, bump when need to recreate venv or npm install
|
||||
PIP_VER = "15"
|
||||
NPM_VER = "14"
|
||||
PIP_VER = "16"
|
||||
NPM_VER = "15"
|
||||
|
||||
SETUPTOOLS_VER = "56.1.0"
|
||||
WHEEL_VER = "0.36.2"
|
||||
|
||||
DL_64 = f"https://github.com/wh1te909/rmmagent/releases/download/v{LATEST_AGENT_VER}/winagent-v{LATEST_AGENT_VER}.exe"
|
||||
DL_32 = f"https://github.com/wh1te909/rmmagent/releases/download/v{LATEST_AGENT_VER}/winagent-v{LATEST_AGENT_VER}-x86.exe"
|
||||
|
||||
@@ -263,3 +263,20 @@ def run_nats_api_cmd(mode: str, ids: list[str], timeout: int = 30) -> None:
|
||||
subprocess.run(cmd, capture_output=True, timeout=timeout)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
|
||||
def get_latest_trmm_ver() -> str:
|
||||
url = "https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/api/tacticalrmm/tacticalrmm/settings.py"
|
||||
try:
|
||||
r = requests.get(url, timeout=5)
|
||||
except:
|
||||
return "error"
|
||||
|
||||
try:
|
||||
for line in r.text.splitlines():
|
||||
if "TRMM_VERSION" in line:
|
||||
return line.split(" ")[2].strip('"')
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
return "error"
|
||||
|
||||
@@ -69,7 +69,7 @@ Category or Function - What It Does
|
||||
|
||||
- If they pull data from elsewhere, create comment notes at the top with references for others to audit/validate
|
||||
|
||||
- Good folder locations
|
||||
- Good folder locations to use for standardized things:
|
||||
```
|
||||
c:\ProgramData\TacticalRMM\
|
||||
c:\ProgramData\TacticalRMM\scripts
|
||||
@@ -81,6 +81,35 @@ c:\ProgramData\TacticalRMM\
|
||||
|
||||
- Command Parameters are good. Optional command parameters for extra functions are better.
|
||||
|
||||
- Add standardized Comment headers to scripts (include the first 2, more if appropriate):
|
||||
```powershell
|
||||
<#
|
||||
.Synopsis
|
||||
Short description
|
||||
eg Check IP address
|
||||
.DESCRIPTION
|
||||
Long description
|
||||
eg Checks IP address on all local network adapters, and returns results
|
||||
.EXAMPLE
|
||||
Example of how to use this cmdlet
|
||||
.EXAMPLE
|
||||
Another example of how to use this cmdlet
|
||||
.INPUTS
|
||||
Inputs to this cmdlet (if any)
|
||||
.OUTPUTS
|
||||
Output from this cmdlet (if any)
|
||||
.NOTES
|
||||
General notes
|
||||
eg v1.0
|
||||
.COMPONENT
|
||||
The component this cmdlet belongs to
|
||||
.ROLE
|
||||
The role this cmdlet belongs to
|
||||
.FUNCTIONALITY
|
||||
The functionality that best describes this cmdlet
|
||||
#>
|
||||
```
|
||||
|
||||
### Bad Habits
|
||||
|
||||
- Assumes non-standard configurations
|
||||
|
||||
@@ -46,3 +46,14 @@ Customize to your tastes (it doesn't need to be internet configured, just add re
|
||||
127.0.0.1 mesh.example.com
|
||||
```
|
||||
|
||||
## View mkdocks live edits in browser
|
||||
|
||||
Change stuff in `/docs/docs/`
|
||||
|
||||
mkdocs is Exposed on Port: 8005
|
||||
|
||||
Open: [http://rmm.example.com:8005/](http://rmm.example.com:8005/)
|
||||
|
||||
## View django administration
|
||||
|
||||
Open: [http://rmm.example.com:8000/admin/](http://rmm.example.com:8000/admin/)
|
||||
@@ -64,4 +64,9 @@ Will print very verbose logging during agent install. Useful for troubleshooting
|
||||
```
|
||||
-silent
|
||||
```
|
||||
This will not popup any message boxes during install, either any error messages or the "Installation was successfull" message box that pops up at the end of a successfull install.
|
||||
This will not popup any message boxes during install, either any error messages or the "Installation was successfull" message box that pops up at the end of a successfull install.
|
||||
|
||||
```
|
||||
-proxy "http://proxyserver:port"
|
||||
```
|
||||
Use a http proxy
|
||||
@@ -129,3 +129,6 @@ Copy the url for the meshagent exe (`https://mesh.example.com/agentinvite?c=....
|
||||
Navigate to `https://rmm.example.com` and login with the username/password you created during install.<br/><br/>
|
||||
Once logged in, you will be redirected to the initial setup page.<br/><br/>
|
||||
Create your first client/site, choose the default timezone and then upload the mesh agent you just downloaded.
|
||||
|
||||
!!!note
|
||||
Though it is an unsupported configuration, if you are using HAProxy this might be of use to you [HAProxy Configuration Notes](unsupported_HAProxy.md)
|
||||
119
docs/docs/unsupported_HAProxy.md
Normal file
119
docs/docs/unsupported_HAProxy.md
Normal file
@@ -0,0 +1,119 @@
|
||||
# HAProxy
|
||||
|
||||
!!!note
|
||||
This is not a supported configuration by Tactical RMM, but it's provided here for your reference.
|
||||
|
||||
Check/Change the mesh central config.json, some of the values may be set already, CertUrl must be changed to point to the HAProxy server.
|
||||
|
||||
## Meshcentral Adjustment
|
||||
|
||||
Credit to [@bradhawkins](https://github.com/bradhawkins85)
|
||||
|
||||
Edit Meshcentral config
|
||||
|
||||
```bash
|
||||
nano /meshcentral/meshcentral-data/config.json
|
||||
```
|
||||
|
||||
Insert this (modify `HAProxyIP` to your network)
|
||||
|
||||
```
|
||||
{
|
||||
"settings": {
|
||||
"Port": 4430,
|
||||
"AliasPort": 443,
|
||||
"RedirPort": 800,
|
||||
"TlsOffload": "127.0.0.1",
|
||||
},
|
||||
"domains": {
|
||||
"": {
|
||||
"CertUrl": "https://HAProxyIP:443/",
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Restart meshcentral
|
||||
|
||||
```bash
|
||||
service meshcentral restart
|
||||
```
|
||||
|
||||
## HAProxy Config
|
||||
|
||||
The order of use_backend is important `Tactical-Mesh-WebSocket_ipvANY` must be before `Tactical-Mesh_ipvANY`
|
||||
The values of `timeout connect`, `timeout server`, `timeout tunnel` in `Tactical-Mesh-WebSocket` have been configured to maintain a stable agent connection, however you may need to adjust these values to suit your environment.
|
||||
|
||||
```
|
||||
frontend HTTPS-merged
|
||||
bind 0.0.0.0:443 name 0.0.0.0:443 ssl crt-list /var/etc/haproxy/HTTPS.crt_list #ADJUST THIS TO YOUR OWN SSL CERTIFICATES
|
||||
mode http
|
||||
log global
|
||||
option socket-stats
|
||||
option dontlognull
|
||||
option http-server-close
|
||||
option forwardfor
|
||||
acl https ssl_fc
|
||||
http-request set-header X-Forwarded-Proto http if !https
|
||||
http-request set-header X-Forwarded-Proto https if https
|
||||
timeout client 30000
|
||||
acl RMM var(txn.txnhost) -m sub -i rmm.example.com
|
||||
acl aclcrt_RMM var(txn.txnhost) -m reg -i ^([^\.]*)\.example\.com(:([0-9]){1,5})?$
|
||||
acl API var(txn.txnhost) -m sub -i api.example.com
|
||||
acl aclcrt_API var(txn.txnhost) -m reg -i ^([^\.]*)\.example\.com(:([0-9]){1,5})?$
|
||||
acl is_websocket hdr(Upgrade) -i WebSocket
|
||||
acl is_mesh var(txn.txnhost) -m beg -i mesh.example.com
|
||||
acl aclcrt_MESH-WebSocket var(txn.txnhost) -m reg -i ^([^\.]*)\.example\.com(:([0-9]){1,5})?$
|
||||
acl MESH var(txn.txnhost) -m sub -i mesh.example.com
|
||||
acl aclcrt_MESH var(txn.txnhost) -m reg -i ^([^\.]*)\.example\.com(:([0-9]){1,5})?$
|
||||
#PUT OTHER USE_BACKEND IN HERE
|
||||
use_backend Tactical_ipvANY if RMM aclcrt_RMM
|
||||
use_backend Tactical_ipvANY if API aclcrt_API
|
||||
use_backend Tactical-Mesh-WebSocket_ipvANY if is_websocket is_mesh aclcrt_MESH-WebSocket
|
||||
use_backend Tactical-Mesh_ipvANY if MESH aclcrt_MESH
|
||||
|
||||
frontend http-to-https
|
||||
bind 0.0.0.0:80
|
||||
mode http
|
||||
log global
|
||||
option http-keep-alive
|
||||
timeout client 30000
|
||||
http-request redirect scheme https
|
||||
|
||||
|
||||
backend Tactical_ipvANY
|
||||
mode http
|
||||
id 100
|
||||
log global
|
||||
timeout connect 30000
|
||||
timeout server 30000
|
||||
retries 3
|
||||
option httpchk GET /
|
||||
server tactical 192.168.10.123:443 id 101 ssl check inter 1000 verify none
|
||||
|
||||
|
||||
backend Tactical-Mesh-WebSocket_ipvANY
|
||||
mode http
|
||||
id 113
|
||||
log global
|
||||
timeout connect 3000
|
||||
timeout server 3000
|
||||
retries 3
|
||||
timeout tunnel 3600000
|
||||
http-request add-header X-Forwarded-Host %[req.hdr(Host)]
|
||||
http-request add-header X-Forwarded-Proto https
|
||||
server tactical 192.168.10.123:443 id 101 ssl verify none
|
||||
|
||||
backend Tactical-Mesh_ipvANY
|
||||
mode http
|
||||
id 112
|
||||
log global
|
||||
timeout connect 15000
|
||||
timeout server 15000
|
||||
retries 3
|
||||
option httpchk GET /
|
||||
timeout tunnel 15000
|
||||
http-request add-header X-Forwarded-Host %[req.hdr(Host)]
|
||||
http-request add-header X-Forwarded-Proto https
|
||||
server tactical 192.168.10.123:443 id 101 ssl check inter 1000 verify none
|
||||
```
|
||||
13
install.sh
13
install.sh
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT_VERSION="46"
|
||||
SCRIPT_VERSION="47"
|
||||
SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/install.sh'
|
||||
|
||||
sudo apt install -y curl wget dirmngr gnupg lsb-release
|
||||
@@ -167,11 +167,11 @@ sudo chmod 775 -R /etc/letsencrypt
|
||||
print_green 'Downloading NATS'
|
||||
|
||||
nats_tmp=$(mktemp -d -t nats-XXXXXXXXXX)
|
||||
wget https://github.com/nats-io/nats-server/releases/download/v2.2.0/nats-server-v2.2.0-linux-amd64.tar.gz -P ${nats_tmp}
|
||||
wget https://github.com/nats-io/nats-server/releases/download/v2.2.2/nats-server-v2.2.2-linux-amd64.tar.gz -P ${nats_tmp}
|
||||
|
||||
tar -xzf ${nats_tmp}/nats-server-v2.2.0-linux-amd64.tar.gz -C ${nats_tmp}
|
||||
tar -xzf ${nats_tmp}/nats-server-v2.2.2-linux-amd64.tar.gz -C ${nats_tmp}
|
||||
|
||||
sudo mv ${nats_tmp}/nats-server-v2.2.0-linux-amd64/nats-server /usr/local/bin/
|
||||
sudo mv ${nats_tmp}/nats-server-v2.2.2-linux-amd64/nats-server /usr/local/bin/
|
||||
sudo chmod +x /usr/local/bin/nats-server
|
||||
sudo chown ${USER}:${USER} /usr/local/bin/nats-server
|
||||
rm -rf ${nats_tmp}
|
||||
@@ -354,12 +354,15 @@ sudo chmod +x /usr/local/bin/nats-api
|
||||
|
||||
print_green 'Installing the backend'
|
||||
|
||||
SETUPTOOLS_VER=$(grep "^SETUPTOOLS_VER" /rmm/api/tacticalrmm/tacticalrmm/settings.py | awk -F'[= "]' '{print $5}')
|
||||
WHEEL_VER=$(grep "^WHEEL_VER" /rmm/api/tacticalrmm/tacticalrmm/settings.py | awk -F'[= "]' '{print $5}')
|
||||
|
||||
cd /rmm/api
|
||||
python3.9 -m venv env
|
||||
source /rmm/api/env/bin/activate
|
||||
cd /rmm/api/tacticalrmm
|
||||
pip install --no-cache-dir --upgrade pip
|
||||
pip install --no-cache-dir setuptools==54.2.0 wheel==0.36.2
|
||||
pip install --no-cache-dir setuptools==${SETUPTOOLS_VER} wheel==${WHEEL_VER}
|
||||
pip install --no-cache-dir -r /rmm/api/tacticalrmm/requirements.txt
|
||||
python manage.py migrate
|
||||
python manage.py collectstatic --no-input
|
||||
|
||||
13
restore.sh
13
restore.sh
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT_VERSION="24"
|
||||
SCRIPT_VERSION="25"
|
||||
SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/restore.sh'
|
||||
|
||||
sudo apt update
|
||||
@@ -108,11 +108,11 @@ sudo apt update
|
||||
print_green 'Downloading NATS'
|
||||
|
||||
nats_tmp=$(mktemp -d -t nats-XXXXXXXXXX)
|
||||
wget https://github.com/nats-io/nats-server/releases/download/v2.2.0/nats-server-v2.2.0-linux-amd64.tar.gz -P ${nats_tmp}
|
||||
wget https://github.com/nats-io/nats-server/releases/download/v2.2.2/nats-server-v2.2.2-linux-amd64.tar.gz -P ${nats_tmp}
|
||||
|
||||
tar -xzf ${nats_tmp}/nats-server-v2.2.0-linux-amd64.tar.gz -C ${nats_tmp}
|
||||
tar -xzf ${nats_tmp}/nats-server-v2.2.2-linux-amd64.tar.gz -C ${nats_tmp}
|
||||
|
||||
sudo mv ${nats_tmp}/nats-server-v2.2.0-linux-amd64/nats-server /usr/local/bin/
|
||||
sudo mv ${nats_tmp}/nats-server-v2.2.2-linux-amd64/nats-server /usr/local/bin/
|
||||
sudo chmod +x /usr/local/bin/nats-server
|
||||
sudo chown ${USER}:${USER} /usr/local/bin/nats-server
|
||||
rm -rf ${nats_tmp}
|
||||
@@ -286,12 +286,15 @@ sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE tacticalrmm TO ${pgus
|
||||
gzip -d $tmp_dir/postgres/*.psql.gz
|
||||
PGPASSWORD=${pgpw} psql -h localhost -U ${pgusername} -d tacticalrmm -f $tmp_dir/postgres/db*.psql
|
||||
|
||||
SETUPTOOLS_VER=$(grep "^SETUPTOOLS_VER" /rmm/api/tacticalrmm/tacticalrmm/settings.py | awk -F'[= "]' '{print $5}')
|
||||
WHEEL_VER=$(grep "^WHEEL_VER" /rmm/api/tacticalrmm/tacticalrmm/settings.py | awk -F'[= "]' '{print $5}')
|
||||
|
||||
cd /rmm/api
|
||||
python3.9 -m venv env
|
||||
source /rmm/api/env/bin/activate
|
||||
cd /rmm/api/tacticalrmm
|
||||
pip install --no-cache-dir --upgrade pip
|
||||
pip install --no-cache-dir setuptools==54.2.0 wheel==0.36.2
|
||||
pip install --no-cache-dir setuptools==${SETUPTOOLS_VER} wheel==${WHEEL_VER}
|
||||
pip install --no-cache-dir -r /rmm/api/tacticalrmm/requirements.txt
|
||||
python manage.py migrate
|
||||
python manage.py collectstatic --no-input
|
||||
|
||||
@@ -37,7 +37,7 @@ except ImportError:
|
||||
gzip = None
|
||||
GZIP_BASE = object
|
||||
|
||||
__version__ = "2.1.2"
|
||||
__version__ = "2.1.3"
|
||||
|
||||
|
||||
class FakeShutdownEvent(object):
|
||||
@@ -728,7 +728,9 @@ def build_request(url, data=None, headers=None, bump="0", secure=False):
|
||||
)
|
||||
|
||||
headers.update(
|
||||
{"Cache-Control": "no-cache",}
|
||||
{
|
||||
"Cache-Control": "no-cache",
|
||||
}
|
||||
)
|
||||
|
||||
printer("%s %s" % (("GET", "POST")[bool(data)], final_url), debug=True)
|
||||
@@ -840,6 +842,8 @@ class HTTPDownloader(threading.Thread):
|
||||
f.close()
|
||||
except IOError:
|
||||
pass
|
||||
except HTTP_ERRORS:
|
||||
pass
|
||||
|
||||
|
||||
class HTTPUploaderData(object):
|
||||
@@ -907,7 +911,7 @@ class HTTPUploader(threading.Thread):
|
||||
self.request = request
|
||||
self.request.data.start = self.starttime = start
|
||||
self.size = size
|
||||
self.result = None
|
||||
self.result = 0
|
||||
self.timeout = timeout
|
||||
self.i = i
|
||||
|
||||
@@ -944,6 +948,8 @@ class HTTPUploader(threading.Thread):
|
||||
self.result = 0
|
||||
except (IOError, SpeedtestUploadTimeout):
|
||||
self.result = sum(self.request.data.total)
|
||||
except HTTP_ERRORS:
|
||||
self.result = 0
|
||||
|
||||
|
||||
class SpeedtestResults(object):
|
||||
@@ -1159,7 +1165,9 @@ class Speedtest(object):
|
||||
self._best = {}
|
||||
|
||||
self.results = SpeedtestResults(
|
||||
client=self.config["client"], opener=self._opener, secure=secure,
|
||||
client=self.config["client"],
|
||||
opener=self._opener,
|
||||
secure=secure,
|
||||
)
|
||||
|
||||
@property
|
||||
@@ -1233,7 +1241,7 @@ class Speedtest(object):
|
||||
# times = get_attributes_by_tag_name(root, 'times')
|
||||
client = get_attributes_by_tag_name(root, "client")
|
||||
|
||||
ignore_servers = list(map(int, server_config["ignoreids"].split(",")))
|
||||
ignore_servers = [int(i) for i in server_config["ignoreids"].split(",") if i]
|
||||
|
||||
ratio = int(upload["ratio"])
|
||||
upload_max = int(upload["maxchunkcount"])
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#Uses RunAsUser and BurntToast to display a popup message to the currently logged on user.
|
||||
#Accepts all arguments as the message text or can quote with 'your message here' if using special characters in the message.
|
||||
#Optional: C:\Program Files\TacticalAgent\BurntToastLogo.png will be displayed if the file exists. Image dimensions 478px (W) x 236px (H)
|
||||
#BurntToast Module Source and Examples: https://github.com/Windos/BurntToast
|
||||
#RunAsUser Module Source and Examples: https://github.com/KelvinTegelaar/RunAsUser
|
||||
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
|
||||
42
scripts/Win_File_Copy_Misc.ps1
Normal file
42
scripts/Win_File_Copy_Misc.ps1
Normal file
@@ -0,0 +1,42 @@
|
||||
# Requires WebClient object $webClient defined, e.g. $webClient = New-Object System.Net.WebClient
|
||||
#
|
||||
# Parameters:
|
||||
# $source - The url of folder to copy, with trailing /, e.g. http://website/folder/structure/
|
||||
# $destination - The folder to copy $source to, with trailing \ e.g. D:\CopyOfStructure\
|
||||
# $recursive - True if subfolders of $source are also to be copied or False to ignore subfolders
|
||||
|
||||
Function Copy-Folder([string]$source, [string]$destination, [bool]$recursive) {
|
||||
if (!$(Test-Path($destination))) {
|
||||
New-Item $destination -type directory -Force
|
||||
}
|
||||
|
||||
# Get the file list from the web page
|
||||
$webString = $webClient.DownloadString($source)
|
||||
$lines = [Regex]::Split($webString, "<br>")
|
||||
# Parse each line, looking for files and folders
|
||||
foreach ($line in $lines) {
|
||||
if ($line.ToUpper().Contains("HREF")) {
|
||||
# File or Folder
|
||||
if (!$line.ToUpper().Contains("[TO PARENT DIRECTORY]")) {
|
||||
# Not Parent Folder entry
|
||||
$items = [Regex]::Split($line, """")
|
||||
$items = [Regex]::Split($items[2], "(>|<)")
|
||||
$item = $items[2]
|
||||
if ($line.ToLower().Contains("<dir>")) {
|
||||
# Folder
|
||||
if ($recursive) {
|
||||
# Subfolder copy required
|
||||
Copy-Folder "$source$item/" "$destination$item/" $recursive
|
||||
}
|
||||
else {
|
||||
# Subfolder copy not required
|
||||
}
|
||||
}
|
||||
else {
|
||||
# File
|
||||
$webClient.DownloadFile("$source$item", "$destination$item")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
scripts/Win_MSI_Install.ps1
Normal file
27
scripts/Win_MSI_Install.ps1
Normal file
@@ -0,0 +1,27 @@
|
||||
Function Install-MSI {
|
||||
Param (
|
||||
[Parameter(Mandatory, ValueFromPipeline = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[System.IO.FileInfo]$File,
|
||||
[String[]]$AdditionalParams,
|
||||
[Switch]$OutputLog
|
||||
)
|
||||
$DataStamp = get-date -Format yyyyMMddTHHmmss
|
||||
$logFile = "$($env:programdata)\CentraStage\MilesRMM\{0}-{1}.log" -f $file.fullname, $DataStamp
|
||||
$MSIArguments = @(
|
||||
"/i",
|
||||
('"{0}"' -f $file.fullname),
|
||||
"/qn",
|
||||
"/norestart",
|
||||
"/L*v",
|
||||
$logFile
|
||||
)
|
||||
if ($additionalParams) {
|
||||
$MSIArguments += $additionalParams
|
||||
}
|
||||
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow
|
||||
if ($OutputLog.IsPresent) {
|
||||
$logContents = get-content $logFile
|
||||
Write-Output $logContents
|
||||
}
|
||||
}
|
||||
1
scripts/Win_Network_TCP_Reset_Stack.bat
Normal file
1
scripts/Win_Network_TCP_Reset_Stack.bat
Normal file
@@ -0,0 +1 @@
|
||||
netsh int ip reset
|
||||
61
scripts/Win_Outlook_SentItems_To_Delegated_Folders.ps1
Normal file
61
scripts/Win_Outlook_SentItems_To_Delegated_Folders.ps1
Normal file
@@ -0,0 +1,61 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Outlook - Delegated folders set for all profiles
|
||||
.DESCRIPTION
|
||||
Uses RunAsUser to setup sent items for the currently logged on user on delegated folders to go into the delegated folders sent for all.
|
||||
Applies to Office 2016 and later, modify reg key for older versions of office.
|
||||
https://docs.microsoft.com/en-us/outlook/troubleshoot/email-management/email-remains-in-the-outbox-when-you-use-the-deleg
|
||||
.NOTES
|
||||
v1.0
|
||||
Submitted by: https://github.com/dinger1986
|
||||
#>
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
$regpath = HKCU:\Software\Microsoft\Office\16.0\Outlook\Preferences
|
||||
$regname = DelegateSentItemsStyle
|
||||
$regvalue = 1
|
||||
$regproperty = Dword
|
||||
|
||||
|
||||
If (!(test-path '%ProgramData%\Tactical RMM\temp')) {
|
||||
New-Item -ItemType Directory -Force -Path '%ProgramData%\Tactical RMM\temp'
|
||||
}
|
||||
|
||||
If (!(test-path C:\TEMP\curpsxpolicy.txt)) {
|
||||
$curexpolicy = Get-ExecutionPolicy
|
||||
|
||||
(
|
||||
echo $curexpolicy
|
||||
)>"%ProgramData%\Tactical RMM\temp\curpsxpolicy.txt"
|
||||
}
|
||||
|
||||
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
|
||||
|
||||
if (Get-PackageProvider -Name NuGet) {
|
||||
Write-Output "NuGet Already Added"
|
||||
}
|
||||
else {
|
||||
Write-Host "Installing NuGet"
|
||||
Install-PackageProvider -Name NuGet -Force
|
||||
}
|
||||
|
||||
if (Get-Module -ListAvailable -Name RunAsUser) {
|
||||
Write-Output "RunAsUser Already Installed"
|
||||
}
|
||||
else {
|
||||
Write-Output "Installing RunAsUser"
|
||||
Install-Module -Name RunAsUser -Force
|
||||
}
|
||||
|
||||
Invoke-AsCurrentUser -scriptblock {
|
||||
New-ItemProperty -Path "$regpath" -Name "$regname" -Value "$regvalue" -PropertyType "$regproperty"
|
||||
}
|
||||
|
||||
Write-Output "Successfully changed Sent Items for Delegated folders"
|
||||
|
||||
$curpsxpol = Get-Content -Path "%ProgramData%\Tactical RMM\temp\curpsxpolicy.txt";
|
||||
|
||||
Set-ExecutionPolicy -ExecutionPolicy $curpsxpol
|
||||
|
||||
del "%ProgramData%\Tactical RMM\temp\curpsxpolicy.txt"
|
||||
@@ -1,17 +1,22 @@
|
||||
<#
|
||||
Requires global variables for serviceName "ScreenConnectService" and url "ScreenConnectInstaller"
|
||||
Requires global variables for serviceName "ScreenConnectService" and url "ScreenConnectInstaller"'
|
||||
serviceName is the name of the ScreenConnect Service once it is installed EG: "ScreenConnect Client (1327465grctq84yrtocq)"
|
||||
url is the path the download the exe version of the ScreenConnect Access installer
|
||||
Both variables values must start and end with "
|
||||
url is the path the download the exe version of the ScreenConnect Access installer'
|
||||
Both variables values must start and end with " (Prior to TRMM Version 0.6.5), remove / don't use " on TRMM Version 0.6.5 or later.
|
||||
Also accepts uninstall variable to remove the installed instance if required.
|
||||
#>
|
||||
|
||||
param (
|
||||
[string] $serviceName,
|
||||
[string] $url,
|
||||
[string] $clientname,
|
||||
[string] $sitename,
|
||||
[string] $action
|
||||
)
|
||||
|
||||
$clientname = $clientname.Replace(" ","%20")
|
||||
$sitename = $sitename.Replace(" ","%20")
|
||||
$url = $url.Replace("&t=&c=&c=&c=&c=&c=&c=&c=&c=","&t=&c=$clientname&c=$sitename&c=&c=&c=&c=&c=&c=")
|
||||
$ErrorCount = 0
|
||||
|
||||
if (!$serviceName) {
|
||||
@@ -82,7 +87,7 @@ if ($action -eq "uninstall") {
|
||||
{
|
||||
$start_time = Get-Date
|
||||
$wc = New-Object System.Net.WebClient
|
||||
$wc.DownloadFile("$url", "$OutPath\$output")
|
||||
$wc.DownloadFile("$url&c=$company&c=$site", "$OutPath\$output")
|
||||
Start-Process -FilePath $OutPath\$output -Wait
|
||||
Write-Output "Time taken to download and install: $((Get-Date).Subtract($start_time).Seconds) second(s)"
|
||||
exit 0
|
||||
|
||||
61
scripts_wip/Alert_MSTeams.ps1
Normal file
61
scripts_wip/Alert_MSTeams.ps1
Normal file
@@ -0,0 +1,61 @@
|
||||
<#
|
||||
Microsoft Teams notifications
|
||||
Submitted by Insane Technologies / David Rudduck
|
||||
requires
|
||||
- agent {{agent.hostname}}
|
||||
- client {{client.name}}
|
||||
- site {{site.name}}
|
||||
- user {{agent.logged_in_user}}
|
||||
- reboot {{agent.needs_reboot}}
|
||||
- patches {{agent.patches_last_installed}}
|
||||
- alert_time {{alert.alert_time}}
|
||||
- message {{alert.message}}
|
||||
- severity {{alert.severity}}
|
||||
#>
|
||||
param (
|
||||
[string] $agent,
|
||||
[string] $client,
|
||||
[string] $site,
|
||||
[string] $user,
|
||||
[string] $reboot,
|
||||
[string] $patches,
|
||||
[string] $time,
|
||||
[string] $message,
|
||||
[string] $severity
|
||||
)
|
||||
|
||||
$webhookurl = 'ADDYOURMSTEAMSWEBHOOKURLHERE'
|
||||
|
||||
if($severity -eq "error"){
|
||||
$colour = 'ff0000'
|
||||
}
|
||||
if($severity -eq "warning"){
|
||||
$color = 'ffa500'
|
||||
}
|
||||
if($severity -eq "info"){
|
||||
$colour = 'ffff00'
|
||||
}
|
||||
|
||||
$msteams_payload = '{"@context": "https://schema.org/extensions", "@type": "MessageCard", "summary": "TacticalRMM Alert", "themeColor": "' + $colour +'", '
|
||||
$msteams_payload = $msteams_payload + '"text": "'
|
||||
|
||||
if($time) {
|
||||
$msteams_payload = $msteams_payload + '<b>Alert Time:</b> ' + $time +'<br>'
|
||||
}
|
||||
|
||||
$msteams_payload = $msteams_payload + '<b>Client:</b> ' + $client +'<br>'
|
||||
$msteams_payload = $msteams_payload + '<b>Site:</b> ' + $site +'<br>'
|
||||
$msteams_payload = $msteams_payload + '<b>Device:</b> ' + $agent +'<br>'
|
||||
if($user) {
|
||||
$msteams_payload = $msteams_payload + '<b>User:</b> ' + $user +'<br>'
|
||||
}
|
||||
if($reboot) {
|
||||
$msteams_payload = $msteams_payload + '<b>Device has pending reboot</b><br>'
|
||||
}
|
||||
if($patches) {
|
||||
$msteams_payload = $msteams_payload + '<b>Patches were last applied:</b> ' + $patches +'<br>'
|
||||
}
|
||||
$msteams_payload = $msteams_payload + $message + '"}'
|
||||
|
||||
# Write-Output $msteams_payload
|
||||
Invoke-RestMethod -Method post -ContentType 'Application/Json' -Body $msteams_payload -Uri $webhookurl
|
||||
121
scripts_wip/Mac_Firewall_Enable.sh
Normal file
121
scripts_wip/Mac_Firewall_Enable.sh
Normal file
@@ -0,0 +1,121 @@
|
||||
#!/bin/sh
|
||||
####################################################################################################
|
||||
#
|
||||
# Copyright (c) 2017, JAMF Software, LLC. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the JAMF Software, LLC nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
####################################################################################################
|
||||
#
|
||||
# ABOUT THIS PROGRAM
|
||||
#
|
||||
# NAME
|
||||
# enableFilewall.sh -- Enables or Disables the firewall on macOS.
|
||||
#
|
||||
# SYNOPSIS
|
||||
# sudo enableFirewall.sh
|
||||
# sudo enableFirewall.sh <mountPoint> <computerName> <currentUsername> <enableFirewall>
|
||||
#
|
||||
# If there is a hardcoded value specified for <enableFirewall> in the script,
|
||||
# or if the parameter is not passed by Jamf Pro, the hardcoded value in the script will
|
||||
# be used.
|
||||
#
|
||||
# The data that is specified for the <enableFirewall> parameter should be specified in one of
|
||||
# the following formats. PLEASE NOTE these formats are CASE-SENSITIVE:
|
||||
#
|
||||
# "TRUE" or "true" or "YES" or "yes" -> Turn Firewall ON
|
||||
# "FALSE" or "false" or "NO" or "no" -> Turn Firewall OFF
|
||||
#
|
||||
# Example Usage: sudo enableFirewall.sh "mountPoint" "computerName" "currentUsername" "TRUE"
|
||||
#
|
||||
# DESCRIPTION
|
||||
# This script enables or disables the firewall on macOS 10.7 or later.
|
||||
# It can be used with a hardcoded value in the script, or read in as a parameter.
|
||||
# Since Jamf Pro defines the first three parameters as (1) Mount Point, (2) Computer
|
||||
# Name and (3) Username, we are using the fourth parameter ($4) as the passable parameter to
|
||||
# acquire the status of <enableFirewall>. In addition, the fourth parameter is utilized to set
|
||||
# the enableFirewall value.
|
||||
#
|
||||
####################################################################################################
|
||||
#
|
||||
# HISTORY
|
||||
#
|
||||
# Version: 1.2
|
||||
#
|
||||
# - Created by Nick Amundsen on August 6th, 2008
|
||||
# - Updated by Nick Amundsen on January 21, 2010
|
||||
# - Updated by Brandon Wenger on November 27th, 2017
|
||||
# - Updated by Matthew Mitchell on March 22, 2019
|
||||
#
|
||||
####################################################################################################
|
||||
#
|
||||
# DEFINE VARIABLES & READ IN PARAMETERS
|
||||
#
|
||||
####################################################################################################
|
||||
|
||||
# HARDCODED VALUE FOR "enableFirewall" IS SET HERE
|
||||
enableFirewall=""
|
||||
|
||||
# CHECK TO SEE IF A VALUE WAS PASSED IN PARAMETER 4 AND, IF SO, ASSIGN TO "enableFirewall"
|
||||
if [ "$4" != "" ] && [ "$enableFirewall" == "" ]; then
|
||||
enableFirewall=$4
|
||||
fi
|
||||
|
||||
####################################################################################################
|
||||
#
|
||||
# SCRIPT CONTENTS - DO NOT MODIFY BELOW THIS LINE
|
||||
#
|
||||
####################################################################################################
|
||||
|
||||
#Check to make sure enableFirewall is not blank
|
||||
if [ "$enableFirewall" == "" ]; then
|
||||
echo "Error: The parameter 'enableFirewall' is blank. Please specify a value for parameter 4."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Get the current macOS version (the major release) to check for compatibility
|
||||
#This will return the 'x' in 10.x
|
||||
OS=`/usr/bin/defaults read /System/Library/CoreServices/SystemVersion ProductVersion | awk '{print substr($1,1,5)}' | cut -d . -f2`
|
||||
|
||||
#If the macOS version is greater than or equal to 10.7
|
||||
if [[ $OS -ge 7 ]]; then
|
||||
|
||||
#Check parameter value, if true or yes, turn the firewall on
|
||||
case $enableFirewall in "true" | "TRUE" | "yes" | "YES")
|
||||
echo "Enabling Firewall for macOS 10.$OS ..."
|
||||
/usr/bin/defaults write /Library/Preferences/com.apple.alf globalstate -int 1;;
|
||||
|
||||
#If false or no, turn the firewall off
|
||||
"false" | "FALSE" | "no" | "NO")
|
||||
echo "Disabling Firewall for macOS 10.$OS ..."
|
||||
/usr/bin/defaults write /Library/Preferences/com.apple.alf globalstate -int 0;;
|
||||
esac
|
||||
|
||||
else
|
||||
|
||||
#The macOS version is not supported
|
||||
echo "Unsupported macOS version - 10.7 or later is required."
|
||||
|
||||
fi
|
||||
|
||||
exit 0;
|
||||
1
scripts_wip/Mac_Install_All_Updates.sh
Normal file
1
scripts_wip/Mac_Install_All_Updates.sh
Normal file
@@ -0,0 +1 @@
|
||||
sudo softwareupdate -ia
|
||||
4
scripts_wip/Mac_Network_DNS_Set_to_1.1.1.1.ps1
Normal file
4
scripts_wip/Mac_Network_DNS_Set_to_1.1.1.1.ps1
Normal file
@@ -0,0 +1,4 @@
|
||||
networksetup -setdnsservers Wi-Fi 1.1.1.1
|
||||
networksetup -setdnsservers Wi-Fi 1.0.0.1
|
||||
networksetup -setdnsservers Ethernet 1.1.1.1
|
||||
networksetup -setdnsservers Ethernet 1.0.0.1
|
||||
2
scripts_wip/Mac_SMC_and_NVRAM_Reset.sh
Normal file
2
scripts_wip/Mac_SMC_and_NVRAM_Reset.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
pmset -a restoredefaults
|
||||
nvram -c
|
||||
5
scripts_wip/Win_AD_Join_Computer.ps1
Normal file
5
scripts_wip/Win_AD_Join_Computer.ps1
Normal file
@@ -0,0 +1,5 @@
|
||||
$domain = "myDomain"
|
||||
$password = "myPassword!" | ConvertTo-SecureString -asPlainText -Force
|
||||
$username = "$domain\myUserAccount"
|
||||
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
|
||||
Add-Computer -DomainName $domain -OUPath "OU=testOU,DC=domain,DC=Domain,DC=com" -Credential $credential -Restart
|
||||
4
scripts_wip/Win_AD_Transfer_FSMO_Roles.ps1
Normal file
4
scripts_wip/Win_AD_Transfer_FSMO_Roles.ps1
Normal file
@@ -0,0 +1,4 @@
|
||||
# Transfer FSMO Roles to server
|
||||
# Make this machine the FSMO Master role.
|
||||
|
||||
Move-ADDirectoryServerOperationMasterRole -Identity $env:computername -OperationMasterRole pdcemulator,ridmaster,infrastructuremaster,schemamaster,domainnamingmaster -Force
|
||||
1
scripts_wip/Win_Bitlocker_Recover_Key.bat
Normal file
1
scripts_wip/Win_Bitlocker_Recover_Key.bat
Normal file
@@ -0,0 +1 @@
|
||||
manage-bde -protectors C: -get
|
||||
35
scripts_wip/Win_Blue_Screen_View_And_Email.bat
Normal file
35
scripts_wip/Win_Blue_Screen_View_And_Email.bat
Normal file
@@ -0,0 +1,35 @@
|
||||
## Update this script for your company, Modify the "mail variables" section
|
||||
## Also, host BlueScreenView.exe on a website and update the $url variable
|
||||
## location accordingly
|
||||
##
|
||||
## Blue Screen View is available as freeware at
|
||||
## https://www.nirsoft.net/utils/blue_screen_view.html
|
||||
|
||||
|
||||
###script variables
|
||||
$scriptName = "Blue Screen View"
|
||||
$computerName = (get-wmiObject win32_computersystem).name
|
||||
$computerDomain = (get-wmiObject win32_computersystem).domain
|
||||
if($computerdomain -notlike '*.*'){ #if there's no period in the domain, (workgroup)
|
||||
$computerDomain = "$computerDomain.local"
|
||||
}
|
||||
|
||||
###mail variables
|
||||
$smtpServer = 'mail.server.com'
|
||||
$smtpPort = '25'
|
||||
$smtpFrom = "Atera-$computername@$computerdomain"
|
||||
$smtpTo = 'support@YOURDOMAIN.com'
|
||||
$messageSubject = "Atera Script: $computerName, $scriptName"
|
||||
$attachment = "c:\windows\temp\crashes.html"
|
||||
$messageBody += "----See Attachment----"
|
||||
|
||||
###script start
|
||||
$messageBody = "----Blue Screen View Results----`r`n"
|
||||
$url = "https://YOURDOMAIN.com/files/BlueScreenView.exe"
|
||||
$filename = "BlueScreenView.exe"
|
||||
$client = New-Object System.Net.WebClient
|
||||
$client.DownloadFile($url, "$env:temp\$filename")
|
||||
Start-Process -FilePath "$env:temp\$filename" -ArgumentList "/shtml","c:\Windows\temp\crashes.html","/sort 2","/sort ~1"""
|
||||
|
||||
###send mail
|
||||
Send-MailMessage -Port $smtpPort -SmtpServer $smtpServer -From $smtpFrom -To $smtpTo -Subject $messageSubject -Body $messageBody -Attachments $attachment
|
||||
61
scripts_wip/Win_Chocolatey_Update_Apps.ps1
Normal file
61
scripts_wip/Win_Chocolatey_Update_Apps.ps1
Normal file
@@ -0,0 +1,61 @@
|
||||
function Update-ChocoApps {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Update choco apps and removes the newly created shortcuts.
|
||||
|
||||
.DESCRIPTION
|
||||
Update choco apps and removes the newly created shortcuts.
|
||||
Requires administrator privileges.
|
||||
|
||||
.NOTES
|
||||
Author: Chris Stafford
|
||||
Version: 1.0.5
|
||||
Created: 2020.06.17
|
||||
Modified: 2020.08.06
|
||||
#>
|
||||
|
||||
# Require Admin Permissions
|
||||
$IsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||
|
||||
if ($IsAdmin -eq $false) {
|
||||
Write-Warning 'Admin Rights Required'
|
||||
break
|
||||
}
|
||||
|
||||
$StartTime = Get-Date
|
||||
|
||||
# Aborts if Chocolatey is not installed
|
||||
if (Test-Path 'C:\ProgramData\chocolatey\choco.exe') {
|
||||
# Locations for shortcuts to remove
|
||||
$Desktops = "$env:PUBLIC\Desktop", "$env:USERPROFILE\Desktop"
|
||||
|
||||
$Choco = 'C:\ProgramData\chocolatey\choco.exe'
|
||||
|
||||
# Parse outdated app names from choco (leave the space in ' Outdated*')
|
||||
Write-Output 'Searching for Outdated Apps'
|
||||
$AppList = & $Choco outdated --limit-output | ForEach-Object { $_.Split('|')[0] }
|
||||
|
||||
# Skips if no apps are outdated
|
||||
if ($AppList.Count -gt 0) {
|
||||
foreach ($App in $AppList) {
|
||||
# upgrade app
|
||||
& $Choco upgrade $App --confirm --limit-output --no-progress
|
||||
|
||||
if ($App -like '*.install') {
|
||||
$App = $App.Split('.')[0]
|
||||
}
|
||||
# removes shortcut (created by install) based on the app name and time created
|
||||
Write-Output "Removing Shortcut: $App"
|
||||
$Desktops | Get-ChildItem -Filter "*.lnk" -ErrorAction SilentlyContinue | Where-Object { $_.LastWriteTime -gt $StartTime } | Remove-Item
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Output 'No Outdated Apps'
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Output 'Chocolatey is not installed'
|
||||
}
|
||||
}
|
||||
|
||||
Update-ChocoApps
|
||||
17
scripts_wip/Win_Chrome_Cache_Clear.bat
Normal file
17
scripts_wip/Win_Chrome_Cache_Clear.bat
Normal file
@@ -0,0 +1,17 @@
|
||||
ECHO --------------------------------------
|
||||
ECHO **** Clearing Chrome cache
|
||||
taskkill /F /IM "chrome.exe">nul 2>&1
|
||||
|
||||
set ChromeDataDir="C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default"
|
||||
set ChromeCache=%ChromeDataDir%\Cache>nul 2>&1
|
||||
del /q /s /f "%ChromeCache%\*.*">nul 2>&1
|
||||
del /q /f "%ChromeDataDir%\*Cookies*.*">nul 2>&1
|
||||
del /q /f "%ChromeDataDir%\*History*.*">nul 2>&1
|
||||
|
||||
|
||||
set ChromeDataDir="C:\Users\%USERNAME%\Local Settings\Application Data\Google\Chrome\User Data\Default"
|
||||
set ChromeCache=%ChromeDataDir%\Cache>nul 2>&1
|
||||
del /q /s /f "%ChromeCache%\*.*">nul 2>&1
|
||||
del /q /f "%ChromeDataDir%\*Cookies*.*">nul 2>&1
|
||||
del /q /f "%ChromeDataDir%\*History*.*">nul 2>&1
|
||||
ECHO **** Clearing Chrome cache DONE
|
||||
12
scripts_wip/Win_Chrome_Clear_Browsing History.bat
Normal file
12
scripts_wip/Win_Chrome_Clear_Browsing History.bat
Normal file
@@ -0,0 +1,12 @@
|
||||
taskkill /F /IM "chrome.exe">nul 2>&1
|
||||
set ChromeDataDir=C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default
|
||||
set ChromeCache=%ChromeDataDir%\Cache>nul 2>&1
|
||||
del /q /s /f "%ChromeCache%\*.*">nul 2>&1
|
||||
del /q /f "%ChromeDataDir%\*Cookies*.*">nul 2>&1
|
||||
del /q /f "%ChromeDataDir%\*History*.*">nul 2>&1
|
||||
|
||||
set ChromeDataDir=C:\Users\%USERNAME%\Local Settings\Application Data\Google\Chrome\User Data\Default
|
||||
set ChromeCache=%ChromeDataDir%\Cache>nul 2>&1
|
||||
del /q /s /f "%ChromeCache%\*.*">nul 2>&1
|
||||
del /q /f "%ChromeDataDir%\*Cookies*.*">nul 2>&1
|
||||
del /q /f "%ChromeDataDir%\*History*.*">nul 2>&1
|
||||
73
scripts_wip/Win_Collect_System_Report_And_Email.ps1
Normal file
73
scripts_wip/Win_Collect_System_Report_And_Email.ps1
Normal file
@@ -0,0 +1,73 @@
|
||||
#The following variables should be changed:
|
||||
#$file ? should be named with a .htm ending
|
||||
#$fromaddress
|
||||
#$toaddress
|
||||
#$smtpserver
|
||||
#$Password
|
||||
#$port
|
||||
|
||||
$file = "C:\Temp\Report.htm"
|
||||
|
||||
#HTML Styling
|
||||
|
||||
$a = "<style>BODY{font-family: Calibri; font-size: 15pt;}"
|
||||
$a = $a + "TABLE{border: 1px solid black; border-collapse: collapse;}"
|
||||
$a = $a + "TH{border: 1px solid green; background: lightgreen; padding: 5px; }"
|
||||
$a = $a + "TD{border: 1px solid green; padding: 5px; }"
|
||||
$a = $a + "</style>"
|
||||
|
||||
#Heading
|
||||
|
||||
"<H1 style='color:green;'>System Report For Agent</H1>" | Out-File $file -Append
|
||||
|
||||
#Network Information
|
||||
|
||||
Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'True'"|
|
||||
Select PSComputername, DNSHostName, Description,
|
||||
@{Name = "IPAddress";Expression =
|
||||
{[regex]$rx = "(\d{1,3}(\.?)){4}"
|
||||
$rx.matches($_.IPAddress).Value}},MACAddress | ConvertTo-HTML -Head "<H2 style='color:green;'>Network Information</H2>" -body $a | Out-file $file -Append
|
||||
|
||||
#Get Event logs
|
||||
|
||||
Get-EventLog -LogName Application -Newest 10 -EntryType Error | Select TimeGenerated, EventID, Source, Message | ConvertTo-HTML -Head "<H2 style='color:green;'>Application Error Event Logs</H2>" -body $a | Out-file $file -Append
|
||||
Get-EventLog -LogName Application -Newest 10 -EntryType Warning | Select TimeGenerated, EventID, Source, Message | ConvertTo-HTML -Head "<H2 style='color:green;'>Application Warning Event Logs</H2>" -body $a | Out-file $file -Append
|
||||
Get-EventLog -LogName System -Newest 10 -EntryType Error | Select TimeGenerated, EventID, Source, Message | ConvertTo-HTML -Head "<H2 style='color:green;'>System Error Event Logs</H2>" -body $a | Out-file $file -Append
|
||||
Get-EventLog -LogName System -Newest 10 -EntryType Warning | Select TimeGenerated, EventID, Source, Message | ConvertTo-HTML -Head "<H2 style='color:green;'>System Warning Event Logs</H2>" -body $a | Out-file $file -Append
|
||||
|
||||
#Get Stopped Services
|
||||
|
||||
Get-Service | Where {($_.Status) -eq "Stopped"} | Select Status, Name, DisplayName | ConvertTo-HTML -Head "<H2 style='color:green;'>Stopped Services</H2>" -body $a | Out-File $file -Append
|
||||
|
||||
#Get Processes and CPU
|
||||
|
||||
Get-Process | Select Id, ProcessName, CPU | ConvertTo-HTML -Head "<H2 style='color:green;'>Processes & CPU</H2>" -body $a | Out-File $file -Append
|
||||
|
||||
#Get Mapped Drives
|
||||
|
||||
Get-PSDrive | Where {$_.Used -ne $null} | Select Name, @{n='Used';e={[float]($_.Used/1GB)}}, @{n='Free';e={[float]($_.Free/1GB)}}, Root| ConvertTo-HTML -Head "<H2 style='color:green;'>Mapped Drives</H2>" -body $a | Out-File $file -Append
|
||||
|
||||
#Get Printers
|
||||
|
||||
Get-Printer | Select Name, Type, PortName | ConvertTo-HTML -Head "<H2 style='color:green;'>Printers</H2>" -body $a | Out-file $file -append
|
||||
|
||||
#Send Email
|
||||
|
||||
$fromaddress = "<insert your email address>"
|
||||
$toaddress = "<insert your email address>"
|
||||
$Subject = "System Report for Agent"
|
||||
$body = Get-Content $file
|
||||
$smtpserver = "<your smtp address>" #for example, smtp.office365.com
|
||||
$Password = "<insert your email password>"
|
||||
$port = <insert smtp port> #for example, 587
|
||||
|
||||
$message = new-object System.Net.Mail.MailMessage
|
||||
$message.IsBodyHTML = $true
|
||||
$message.From = $fromaddress
|
||||
$message.To.Add($toaddress)
|
||||
$message.Subject = $Subject
|
||||
$message.body = $body
|
||||
$smtp = new-object Net.Mail.SmtpClient($smtpserver, $port)
|
||||
$smtp.EnableSsl = $true
|
||||
$smtp.Credentials = New-Object System.Net.NetworkCredential($fromaddress, $Password)
|
||||
$smtp.Send($message)
|
||||
8
scripts_wip/Win_DNS_Get_Domain_MX_Records(fixme).bat
Normal file
8
scripts_wip/Win_DNS_Get_Domain_MX_Records(fixme).bat
Normal file
@@ -0,0 +1,8 @@
|
||||
@echo off
|
||||
rem Get's the MX records for a domain
|
||||
rem To use a variable instaed of having to put the domain into the script
|
||||
rem change line 6 to `set domain="\{[DOMAIN]\}" (remove backslashes)
|
||||
|
||||
set domain="PUT DOMAIN TO CHECK HERE"
|
||||
|
||||
nslookup -type=mx %doamin%
|
||||
20
scripts_wip/Win_Defender_Enable_ApplicationGuard.ps1
Normal file
20
scripts_wip/Win_Defender_Enable_ApplicationGuard.ps1
Normal file
@@ -0,0 +1,20 @@
|
||||
# Script to Install Windows Defender Application Guard.
|
||||
# Created by TechCentre with the help and assistance of the internet.
|
||||
# Restart Required to complete install.
|
||||
|
||||
# Sets Variable for feature to be installed.
|
||||
$FeatureName = "Windows-Defender-ApplicationGuard"
|
||||
|
||||
# If Feature Installed already then skips otherwise installs.
|
||||
if((Get-WindowsOptionalFeature -FeatureName $FeatureName -Online).State -eq "Enabled") {
|
||||
|
||||
write-host "Installed"
|
||||
|
||||
} else {
|
||||
|
||||
write-host "not Installed"
|
||||
|
||||
Enable-WindowsOptionalFeature -online -FeatureName $FeatureName -NoRestart
|
||||
|
||||
}
|
||||
|
||||
1
scripts_wip/Win_Disk_Auto_Cleaner.bat
Normal file
1
scripts_wip/Win_Disk_Auto_Cleaner.bat
Normal file
@@ -0,0 +1 @@
|
||||
cleanmgr.exe /AUTOCLEAN
|
||||
16
scripts_wip/Win_Disk_Cleanup.ps1
Normal file
16
scripts_wip/Win_Disk_Cleanup.ps1
Normal file
@@ -0,0 +1,16 @@
|
||||
# Create reg keys
|
||||
$volumeCaches = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"
|
||||
foreach($key in $volumeCaches)
|
||||
{
|
||||
New-ItemProperty -Path "$($key.PSPath)" -Name StateFlags0099 -Value 2 -Type DWORD -Force | Out-Null
|
||||
}
|
||||
|
||||
# Run Disk Cleanup
|
||||
Start-Process -Wait "$env:SystemRoot\System32\cleanmgr.exe" -ArgumentList "/sagerun:99"
|
||||
|
||||
# Delete the keys
|
||||
$volumeCaches = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"
|
||||
foreach($key in $volumeCaches)
|
||||
{
|
||||
Remove-ItemProperty -Path "$($key.PSPath)" -Name StateFlags0099 -Force | Out-Null
|
||||
}
|
||||
5
scripts_wip/Win_Disk_Delete_Temp_Files.bat
Normal file
5
scripts_wip/Win_Disk_Delete_Temp_Files.bat
Normal file
@@ -0,0 +1,5 @@
|
||||
DEL /S /Q "%TMP%\*.*"
|
||||
DEL /S /Q "%TEMP%\*.*"
|
||||
DEL /S /Q "%WINDIR%\Temp\*.*"
|
||||
DEL /S /Q "%USERPROFILE%\Local Settings\Temp\*.*"
|
||||
DEL /S /Q "%LOCALAPPDATA%\Temp\*.*"
|
||||
@@ -0,0 +1,4 @@
|
||||
#Update with command parameters
|
||||
|
||||
|
||||
get-ChildItem C:\ -recurse -erroraction silentlycontinue | sort length -descending | select -first 10
|
||||
25
scripts_wip/Win_Drive_Info_Get.ps1
Normal file
25
scripts_wip/Win_Drive_Info_Get.ps1
Normal file
@@ -0,0 +1,25 @@
|
||||
###
|
||||
# Author: Dave Long <dlong@cagedata.com>
|
||||
# Gets a list of all mount points and what type of drive the
|
||||
# mount point is stored on
|
||||
###
|
||||
|
||||
# Get all of the physical disks attached to system
|
||||
$Partitions = Get-Partition | Where-Object { [string]($_.DriveLetter) -ne "" }
|
||||
|
||||
$Output = @()
|
||||
|
||||
$Partitions | ForEach-Object {
|
||||
$Disk = Get-PhysicalDisk -DeviceNumber $_.DiskNumber
|
||||
$Output += [PSCustomObject]@{
|
||||
MountPoint = $_.DriveLetter
|
||||
DiskType = $Disk.MediaType
|
||||
DriveName = $Disk.FriendlyName
|
||||
DriveSerialNumber = $Disk.SerialNumber
|
||||
SizeInGigabytes = $Disk.Size/1GB
|
||||
Health = $Disk.HealthStatus
|
||||
SystemDrive = $env:SystemDrive[0] -eq $_.DriveLetter ? $true : $false
|
||||
}
|
||||
}
|
||||
|
||||
$Output | Format-Table
|
||||
15
scripts_wip/Win_Event_Logs_Clear_All.bat
Normal file
15
scripts_wip/Win_Event_Logs_Clear_All.bat
Normal file
@@ -0,0 +1,15 @@
|
||||
@echo off
|
||||
for /F %%a IN (?wevtutil el?) DO (wevtutil.exe cl %%a >nul 2>&1)
|
||||
IF (%adminTest%)==(Access) goto noAdmin
|
||||
for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G")
|
||||
echo.
|
||||
echo Event Logs have been cleared!
|
||||
goto theEnd
|
||||
:do_clear
|
||||
echo clearing %1
|
||||
wevtutil.exe cl %1
|
||||
goto :eof
|
||||
:noAdmin
|
||||
echo You must run this script as an Administrator!
|
||||
echo.
|
||||
:theEnd
|
||||
1
scripts_wip/Win_Event_Logs_Clear_Application.bat
Normal file
1
scripts_wip/Win_Event_Logs_Clear_Application.bat
Normal file
@@ -0,0 +1 @@
|
||||
Wevtutil.exe cl Application
|
||||
1
scripts_wip/Win_Event_Logs_Clear_System.bat
Normal file
1
scripts_wip/Win_Event_Logs_Clear_System.bat
Normal file
@@ -0,0 +1 @@
|
||||
Wevtutil.exe cl System
|
||||
53
scripts_wip/Win_File_Detect_and_Alert.ps1
Normal file
53
scripts_wip/Win_File_Detect_and_Alert.ps1
Normal file
@@ -0,0 +1,53 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Detect if object exists and gives error
|
||||
.DESCRIPTION
|
||||
Long description
|
||||
.EXAMPLE
|
||||
Example of how to use this cmdlet
|
||||
.EXAMPLE
|
||||
Another example of how to use this cmdlet
|
||||
#>
|
||||
|
||||
If ((Test-Path -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Tactical RMM Agent.lnk" -PathType Leaf) -eq $false ) {
|
||||
|
||||
Write-Output "No Shortcut"
|
||||
exit 0
|
||||
|
||||
}
|
||||
Else {
|
||||
|
||||
Write-Output 'Shortcut Exists'
|
||||
exit 1
|
||||
}
|
||||
|
||||
Exit $LASTEXITCODE
|
||||
|
||||
# function Verb-Noun
|
||||
# {
|
||||
# [CmdletBinding()]
|
||||
# [Alias()]
|
||||
# [OutputType([int])]
|
||||
# Param
|
||||
# (
|
||||
# # Param1 help description
|
||||
# [Parameter(Mandatory=$true,
|
||||
# ValueFromPipelineByPropertyName=$true,
|
||||
# Position=0)]
|
||||
# $Param1,
|
||||
|
||||
# # Param2 help description
|
||||
# [int]
|
||||
# $Param2
|
||||
# )
|
||||
|
||||
# Begin
|
||||
# {
|
||||
# }
|
||||
# Process
|
||||
# {
|
||||
# }
|
||||
# End
|
||||
# {
|
||||
# }
|
||||
# }
|
||||
1
scripts_wip/Win_Firewall_Disable_All.bat
Normal file
1
scripts_wip/Win_Firewall_Disable_All.bat
Normal file
@@ -0,0 +1 @@
|
||||
netsh advfirewall set allprofiles state off
|
||||
7
scripts_wip/Win_Folder_Downloads_Clear.ps1
Normal file
7
scripts_wip/Win_Folder_Downloads_Clear.ps1
Normal file
@@ -0,0 +1,7 @@
|
||||
$root="c:\users"
|
||||
$users=get-childitem -path $root -exclude administrator, public
|
||||
foreach ($user in $users)
|
||||
{
|
||||
$folder= join-path -path $user -childpath "downloads\*"
|
||||
Get-childitem $folder -recurse | remove-item -force
|
||||
}
|
||||
1
scripts_wip/Win_Info_Last_Password_Change_Date.bat
Normal file
1
scripts_wip/Win_Info_Last_Password_Change_Date.bat
Normal file
@@ -0,0 +1 @@
|
||||
NET USER %username% /DOMAIN | FIND /I "Password last set"
|
||||
6
scripts_wip/Win_Info_Last_Reboot_Info.ps1
Normal file
6
scripts_wip/Win_Info_Last_Reboot_Info.ps1
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
#Find last reboot information
|
||||
|
||||
gwmi win32_ntlogevent -filter "LogFile='System' and EventCode='1074' and Message like '%restart%'" |
|
||||
select User,@{n="Time";e={$_.ConvertToDateTime($_.TimeGenerated)}}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
powercfg /batteryreport /output "C:\battery-report.html"
|
||||
37
scripts_wip/Win_Lockscreen_Background_Set.ps1
Normal file
37
scripts_wip/Win_Lockscreen_Background_Set.ps1
Normal file
@@ -0,0 +1,37 @@
|
||||
$RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"
|
||||
|
||||
$DesktopPath = "DesktopImagePath"
|
||||
$DesktopStatus = "DesktopImageStatus"
|
||||
$DesktopUrl = "DesktopImageUrl"
|
||||
$LockScreenPath = "LockScreenImagePath"
|
||||
$LockScreenStatus = "LockScreenImageStatus"
|
||||
$LockScreenUrl = "LockScreenImageUrl"
|
||||
|
||||
$StatusValue = "1"
|
||||
$DesktopImageValue = "C:\Lakes\Desktop.jpg" #Change as per your needs
|
||||
$LockScreenImageValue = "C:\Lakes\LockScreen.jpg" #Change as per your needs
|
||||
|
||||
IF(!(Test-Path $RegKeyPath))
|
||||
|
||||
{
|
||||
|
||||
New-Item -Path $RegKeyPath -Force | Out-Null
|
||||
|
||||
New-ItemProperty -Path $RegKeyPath -Name $DesktopStatus -Value $StatusValue -PropertyType DWORD -Force | Out-Null
|
||||
New-ItemProperty -Path $RegKeyPath -Name $LockScreenStatus -Value $StatusValue -PropertyType DWORD -Force | Out-Null
|
||||
New-ItemProperty -Path $RegKeyPath -Name $DesktopPath -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null
|
||||
New-ItemProperty -Path $RegKeyPath -Name $DesktopUrl -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null
|
||||
New-ItemProperty -Path $RegKeyPath -Name $LockScreenPath -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
|
||||
New-ItemProperty -Path $RegKeyPath -Name $LockScreenUrl -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
|
||||
|
||||
}
|
||||
|
||||
ELSE {
|
||||
|
||||
New-ItemProperty -Path $RegKeyPath -Name $DesktopStatus -Value $Statusvalue -PropertyType DWORD -Force | Out-Null
|
||||
New-ItemProperty -Path $RegKeyPath -Name $LockScreenStatus -Value $value -PropertyType DWORD -Force | Out-Null
|
||||
New-ItemProperty -Path $RegKeyPath -Name $DesktopPath -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null
|
||||
New-ItemProperty -Path $RegKeyPath -Name $DesktopUrl -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null
|
||||
New-ItemProperty -Path $RegKeyPath -Name $LockScreenPath -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
|
||||
New-ItemProperty -Path $RegKeyPath -Name $LockScreenUrl -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
|
||||
}
|
||||
71
scripts_wip/Win_Login_Audit.ps1
Normal file
71
scripts_wip/Win_Login_Audit.ps1
Normal file
@@ -0,0 +1,71 @@
|
||||
# Define the Variables 1-3
|
||||
|
||||
# 1. Enter the beginning of the time range being reviewed. Use the same time format as configured in the endpoint's time & date settings (for example, for USA date&time: MM-DD-YYY hh:mm:ss).
|
||||
|
||||
$StartTime = "12-01-2017 17:00:00"
|
||||
|
||||
# 2. Enter the end of the time range being reviewed. Use the same time format as configured in the endpoint's time & date settings (for example, for USA date&time: MM-DD-YYY hh:mm:ss).
|
||||
|
||||
$EndTime = "12-14-2017 17:00:00"
|
||||
|
||||
# 3. Location of the result file. Make sure the file type is csv.
|
||||
|
||||
$ResultFile = "C:\Temp\LoginAttemptsResultFile.csv"
|
||||
|
||||
# Create the output file and define the column headers.
|
||||
|
||||
"Time Created, Domain\Username, Login Attempt" | Add-Content $ResultFile
|
||||
|
||||
# Query the server for the login events.
|
||||
|
||||
$colEvents = Get-WinEvent -FilterHashtable @{logname='Security'; StartTime="$StartTime"; EndTime="$EndTime"}
|
||||
|
||||
# Iterate through the collection of login events.
|
||||
|
||||
Foreach ($Entry in $colEvents)
|
||||
|
||||
{
|
||||
|
||||
If (($Entry.Id -eq "4624") -and ($Entry.Properties[8].value -eq "2"))
|
||||
|
||||
{
|
||||
|
||||
$TimeCreated = $Entry.TimeCreated
|
||||
|
||||
$Domain = $Entry.Properties[6].Value
|
||||
|
||||
$Username = $Entry.Properties[5].Value
|
||||
|
||||
$Result = "$TimeCreated,$Domain\$Username,Interactive Login Success" | Add-Content $ResultFile
|
||||
|
||||
}
|
||||
|
||||
If (($Entry.Id -eq "4624") -and ($Entry.Properties[8].value -eq "10"))
|
||||
|
||||
{
|
||||
|
||||
$TimeCreated = $Entry.TimeCreated
|
||||
|
||||
$Domain = $Entry.Properties[6].Value
|
||||
|
||||
$Username = $Entry.Properties[5].Value
|
||||
|
||||
$Result = "$TimeCreated,$Domain\$Username,Remote Login Success" | Add-Content $ResultFile
|
||||
|
||||
}
|
||||
|
||||
If ($Entry.Id -eq "4625")
|
||||
|
||||
{
|
||||
|
||||
$TimeCreated = $Entry.TimeCreated
|
||||
|
||||
$Domain = $Entry.Properties[6].Value
|
||||
|
||||
$Username = $Entry.Properties[5].Value
|
||||
|
||||
$Result = "$TimeCreated,$Domain\$Username,Login Failure" | Add-Content $ResultFile
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
2
scripts_wip/Win_MSOffice_Disable_SaveToOneDrive.bat
Normal file
2
scripts_wip/Win_MSOffice_Disable_SaveToOneDrive.bat
Normal file
@@ -0,0 +1,2 @@
|
||||
REG ADD "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Common\General" /f /v PreferCloudSaveLocations /t REG_DWORD /d 0
|
||||
REG ADD "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Common\Internet" /f /v OnlineStorage /t REG_DWORD /d 3
|
||||
@@ -0,0 +1,93 @@
|
||||
echo OFF
|
||||
cls
|
||||
|
||||
:: Check for MS SQL Server Versions
|
||||
|
||||
set CURRENT_VERSION=nul
|
||||
echo.
|
||||
FOR /F "tokens=3 skip=2" %%i IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion" /v CurrentVersion 2^>nul') DO set CURRENT_VERSION=%%i
|
||||
|
||||
if defined CURRENT_VERSION (
|
||||
:: MS SQL Server 2019 Versions
|
||||
if %CURRENT_VERSION% equ 15.0.2000.5 set SQL_NAME=Microsoft SQL Server 2019
|
||||
:: MS SQL Server 2017 Versions
|
||||
if %CURRENT_VERSION% equ 14.0.1000.169 set SQL_NAME=Microsoft SQL Server 2017
|
||||
:: MS SQL Server 2016 Versions
|
||||
if %CURRENT_VERSION% equ 13.0.5026.0 set SQL_NAME=Microsoft SQL Server 2016 SP2
|
||||
if %CURRENT_VERSION% equ 13.0.4001.0 set SQL_NAME=Microsoft SQL Server 2016 SP1
|
||||
if %CURRENT_VERSION% equ 13.0.1601.5 set SQL_NAME=Microsoft SQL Server 2016
|
||||
:: MS SQL Server 2014 Versions
|
||||
if %CURRENT_VERSION% equ 12.0.6024.1 set SQL_NAME=Microsoft SQL Server 2014 SP3
|
||||
if %CURRENT_VERSION% equ 12.0.5000.0 set SQL_NAME=Microsoft SQL Server 2014 SP2
|
||||
if %CURRENT_VERSION% equ 12.0.4100.1 set SQL_NAME=Microsoft SQL Server 2014 SP1
|
||||
if %CURRENT_VERSION% equ 12.0.2000.8 set SQL_NAME=Microsoft SQL Server 2014
|
||||
:: MS SQL Server 2012 Versions
|
||||
if %CURRENT_VERSION% equ 11.0.7001.0 set SQL_NAME=Microsoft SQL Server 2012 SP4
|
||||
if %CURRENT_VERSION% equ 11.0.6020.0 set SQL_NAME=Microsoft SQL Server 2012 SP3
|
||||
if %CURRENT_VERSION% equ 11.0.5058.0 set SQL_NAME=Microsoft SQL Server 2012 SP2
|
||||
if %CURRENT_VERSION% equ 11.0.3000.0 set SQL_NAME=Microsoft SQL Server 2012 SP1
|
||||
if %CURRENT_VERSION% equ 11.0.2100.60 set SQL_NAME=Microsoft SQL Server 2012
|
||||
:: MS SQL Server 2008 R2 Versions
|
||||
if %CURRENT_VERSION% equ 10.50.6000.34 set SQL_NAME=Microsoft SQL Server 2008 R2 SP3
|
||||
if %CURRENT_VERSION% equ 10.50.4000.0 set SQL_NAME=Microsoft SQL Server 2008 R2 SP2
|
||||
if %CURRENT_VERSION% equ 10.50.2500.0 set SQL_NAME=Microsoft SQL Server 2008 R2 SP1
|
||||
if %CURRENT_VERSION% equ 10.50.1600.1 set SQL_NAME=Microsoft SQL Server 2008 R2
|
||||
:: MS SQL Server 2008 Versions
|
||||
if %CURRENT_VERSION% equ 10.0.6000.29 set SQL_NAME=Microsoft SQL Server 2008 SP4
|
||||
if %CURRENT_VERSION% equ 10.0.5000.0 set SQL_NAME=Microsoft SQL Server 2008 SP3
|
||||
if %CURRENT_VERSION% equ 10.0.4000.0 set SQL_NAME=Microsoft SQL Server 2008 SP2
|
||||
if %CURRENT_VERSION% equ 10.0.2531.0 set SQL_NAME=Microsoft SQL Server 2008 SP1
|
||||
if %CURRENT_VERSION% equ 10.0.1600.22 set SQL_NAME=Microsoft SQL Server 2008
|
||||
)
|
||||
|
||||
if %CURRENT_VERSION% equ nul (
|
||||
echo No Microsoft SQL Server found/installed!
|
||||
) else (
|
||||
echo Installed Microsoft SQL Server Release:
|
||||
echo %SQL_NAME% [%CURRENT_VERSION%]
|
||||
)
|
||||
|
||||
:: Check for MS SQL Server Express Versions
|
||||
|
||||
set CURRENT_VERSION=nul
|
||||
echo.
|
||||
FOR /F "tokens=3 skip=2" %%i IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS\MSSQLServer\CurrentVersion" /v CurrentVersion 2^>nul') DO set CURRENT_VERSION=%%i
|
||||
|
||||
if defined CURRENT_VERSION (
|
||||
:: MS SQL Server 2017 Express Versions
|
||||
if %CURRENT_VERSION% equ 14.0.1000.169 set SQL_NAME=Microsoft SQL Server 2017 Express
|
||||
:: MS SQL Server 2016 Express Versions
|
||||
if %CURRENT_VERSION% equ 13.0.5026.0 set SQL_NAME=Microsoft SQL Server 2016 Express SP2
|
||||
if %CURRENT_VERSION% equ 13.0.4001.0 set SQL_NAME=Microsoft SQL Server 2016 Express SP1
|
||||
if %CURRENT_VERSION% equ 13.0.1601.5 set SQL_NAME=Microsoft SQL Server 2016 Express
|
||||
:: MS SQL Server 2014 Express Versions
|
||||
if %CURRENT_VERSION% equ 12.0.6024.1 set SQL_NAME=Microsoft SQL Server 2014 Express SP3
|
||||
if %CURRENT_VERSION% equ 12.0.5000.0 set SQL_NAME=Microsoft SQL Server 2014 Express SP2
|
||||
if %CURRENT_VERSION% equ 12.0.4100.1 set SQL_NAME=Microsoft SQL Server 2014 Express SP1
|
||||
if %CURRENT_VERSION% equ 12.0.2000.8 set SQL_NAME=Microsoft SQL Server 2014 Express
|
||||
:: MS SQL Server 2012 Express Versions
|
||||
if %CURRENT_VERSION% equ 11.0.7001.0 set SQL_NAME=Microsoft SQL Server 2012 Express SP4
|
||||
if %CURRENT_VERSION% equ 11.0.6020.0 set SQL_NAME=Microsoft SQL Server 2012 Express SP3
|
||||
if %CURRENT_VERSION% equ 11.0.5058.0 set SQL_NAME=Microsoft SQL Server 2012 Express SP2
|
||||
if %CURRENT_VERSION% equ 11.0.3000.0 set SQL_NAME=Microsoft SQL Server 2012 Express SP1
|
||||
if %CURRENT_VERSION% equ 11.0.2100.60 set SQL_NAME=Microsoft SQL Server 2012 Express
|
||||
:: MS SQL Server 2008 R2 Express Versions
|
||||
if %CURRENT_VERSION% equ 10.50.6000.34 set SQL_NAME=Microsoft SQL Server 2008 R2 Express SP3
|
||||
if %CURRENT_VERSION% equ 10.50.4000.0 set SQL_NAME=Microsoft SQL Server 2008 R2 Express SP2
|
||||
if %CURRENT_VERSION% equ 10.50.2500.0 set SQL_NAME=Microsoft SQL Server 2008 R2 Express SP1
|
||||
if %CURRENT_VERSION% equ 10.50.1600.1 set SQL_NAME=Microsoft SQL Server 2008 R2 Express
|
||||
:: MS SQL Server 2008 Express Versions
|
||||
if %CURRENT_VERSION% equ 10.0.6000.29 set SQL_NAME=Microsoft SQL Server 2008 Express SP4
|
||||
if %CURRENT_VERSION% equ 10.0.5000.0 set SQL_NAME=Microsoft SQL Server 2008 Express SP3
|
||||
if %CURRENT_VERSION% equ 10.0.4000.0 set SQL_NAME=Microsoft SQL Server 2008 Express SP2
|
||||
if %CURRENT_VERSION% equ 10.0.2531.0 set SQL_NAME=Microsoft SQL Server 2008 Express SP1
|
||||
if %CURRENT_VERSION% equ 10.0.1600.22 set SQL_NAME=Microsoft SQL Server 2008 Express
|
||||
)
|
||||
|
||||
if %CURRENT_VERSION% equ nul (
|
||||
echo No Microsoft SQL Server Express found/installed!
|
||||
) else (
|
||||
echo Installed Microsoft SQL Server Express Release:
|
||||
echo %SQL_NAME% [%CURRENT_VERSION%]
|
||||
)
|
||||
echo.
|
||||
1
scripts_wip/Win_Network_TCP_FlushDNS.bat
Normal file
1
scripts_wip/Win_Network_TCP_FlushDNS.bat
Normal file
@@ -0,0 +1 @@
|
||||
IPCONFIG /FLUSHDNS
|
||||
9
scripts_wip/Win_OEM_Information_Set.ps1
Normal file
9
scripts_wip/Win_OEM_Information_Set.ps1
Normal file
@@ -0,0 +1,9 @@
|
||||
Invoke-WebRequest -Uri 'http://<fqdn>/Downloads/Assets/CompanyLogo.bmp' -OutFile 'C:\windows\system32\CompanyLogo.bmp'
|
||||
|
||||
# New-Item ?Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\" ?Name "OEMInformation"
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" -Name "Logo" -Value "C:\windows\system32\CompanyLogo.bmp"
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" -Name "Manufacturer" -Value "Company name"
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" -Name "SupportAppURL" -Value "http://<fqdn>"
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" -Name "SupportURL" -Value "http://<fqdn>"
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" -Name "SupportHours" -Value "ma - vr | 08:00 - 17:00"
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" -Name "SupportPhone" -Value "<phone number>"
|
||||
17
scripts_wip/Win_OneDrive_Reset_Cache.ps1
Normal file
17
scripts_wip/Win_OneDrive_Reset_Cache.ps1
Normal file
@@ -0,0 +1,17 @@
|
||||
# Path for the workdir
|
||||
if ( Test-Path -Path "$env:LOCALAPPDATA\Microsoft\OneDrive\OneDrive.exe" -PathType Leaf ) {
|
||||
$workdir = "$env:LOCALAPPDATA\Microsoft\OneDrive"
|
||||
} elseif ( Test-Path -Path "C:\Program Files (x86)\Microsoft\OneDrive\OneDrive.exe" -PathType Leaf ) {
|
||||
$workdir = "C:\Program Files (x86)\Microsoft\OneDrive"
|
||||
} else {
|
||||
Write-Host "OneDrive is not installed"
|
||||
}
|
||||
|
||||
# Start-Process of clearing OneDrive cache
|
||||
$p = Start-Process -FilePath $workdir'\OneDrive.exe' -ArgumentList '/reset' -NoNewWindow -Wait -PassThru
|
||||
$p.ExitCode
|
||||
Write-Host "OneDrive Cache has been cleared."
|
||||
|
||||
# Restart OneDrive
|
||||
$p = Start-Process -FilePath $workdir'\OneDrive.exe' -NoNewWindow -Wait -PassThru
|
||||
$p.ExitCode
|
||||
2
scripts_wip/Win_Outlook_Get_Addins.ps1
Normal file
2
scripts_wip/Win_Outlook_Get_Addins.ps1
Normal file
@@ -0,0 +1,2 @@
|
||||
$searchScopes = "HKCU:\SOFTWARE\Microsoft\Office\Outlook\Addins","HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins"
|
||||
$searchScopes | % {Get-ChildItem -Path $_ | % {Get-ItemProperty -Path $_.PSPath} | Select-Object @{n="Name";e={Split-Path $_.PSPath -leaf}},FriendlyName,Description} | Sort-Object -Unique -Property name
|
||||
4
scripts_wip/Win_Outlook_Increase_PST_MaxSize.bat
Normal file
4
scripts_wip/Win_Outlook_Increase_PST_MaxSize.bat
Normal file
@@ -0,0 +1,4 @@
|
||||
rem Changes the default of 50GB of Outlook data files (PST/OST) storage to 100GB
|
||||
|
||||
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\PST" /v WarnLargeFileSize /f /t REG_DWORD /d 95000
|
||||
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\PST" /v MaxLargeFileSize /f /t REG_DWORD /d 100000
|
||||
15
scripts_wip/Win_Outlook_New_Profile.ps1
Normal file
15
scripts_wip/Win_Outlook_New_Profile.ps1
Normal file
@@ -0,0 +1,15 @@
|
||||
# Script to create a new empty Outlook profile
|
||||
# http://powershell-tools.com/exchange-outlook/create-new-outlook-profile-using-powershell/
|
||||
|
||||
$ofc = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
|
||||
$OfficeInstall = Get-ChildItem -Path $ofc -Recurse | Where-Object {
|
||||
$_.GetValue('DisplayName') -like "Microsoft Office*" -or $_.GetValue('DisplayName') -like "Microsoft 365 Apps*"
|
||||
}
|
||||
|
||||
# We only care about the major and minor version for the next part
|
||||
$Version = $OfficeInstall.GetValue('DisplayVersion')[0..3] -join ""
|
||||
$RegPath = "HKCU:\SOFTWARE\Microsoft\Office\$Version\Outlook"
|
||||
|
||||
New-Item -Path "$RegPath\Profiles" -Name "NewProfile"
|
||||
Set-ItemProperty -Path $RegPath -Name "DefaultProfile" -Value "NewProfile"
|
||||
Write-Host "Restart Outlook to setup new profile"
|
||||
8
scripts_wip/Win_Password_Policy_Modify.ps1
Normal file
8
scripts_wip/Win_Password_Policy_Modify.ps1
Normal file
@@ -0,0 +1,8 @@
|
||||
secedit /export /cfg c:\secpol.cfg
|
||||
(gc C:\secpol.cfg).replace("PasswordComplexity = 0", "PasswordComplexity = 1") | Out-File C:\secpol.cfg
|
||||
(gc C:\secpol.cfg).replace("MaximumPasswordAge = 42", "MaximumPasswordAge = 180") | Out-File C:\secpol.cfg
|
||||
(gc C:\secpol.cfg).replace("PasswordHistorySize = 0", "PasswordHistorySize = 4") | Out-File C:\secpol.cfg
|
||||
(gc C:\secpol.cfg).replace("MinimumPasswordLength = 0", "MinimumPasswordLength = 8") | Out-File C:\secpol.cfg
|
||||
secedit /configure /db C:\windows\security\database\mycustomsecdb.sdb /cfg c:\secpol.cfg /areas SECURITYPOLICY
|
||||
gpupdate
|
||||
rm -force c:\secpol.cfg -confirm:$false
|
||||
19
scripts_wip/Win_Power_And_Sleep_Changer.bat
Normal file
19
scripts_wip/Win_Power_And_Sleep_Changer.bat
Normal file
@@ -0,0 +1,19 @@
|
||||
@echo off
|
||||
|
||||
REM Power and Sleep Settings Script
|
||||
|
||||
REM ac = Plugged in
|
||||
REM dc = Running on battery
|
||||
REM Number at the end of each command is in minutes, 0 means never
|
||||
|
||||
REM Standby = Sleep
|
||||
powercfg /change standby-timeout-ac 0
|
||||
powercfg /change standby-timeout-dc 0
|
||||
|
||||
REM Monitor = Monitor
|
||||
powercfg /change monitor-timeout-ac 0
|
||||
powercfg /change monitor-timeout-dc 0
|
||||
|
||||
REM Hibernate = Hibernate, only used on machines that have hibernate enabled, most use sleep now
|
||||
powercfg /change hibernate-timeout-ac 0
|
||||
powercfg /change hibernate-timeout-dc 0
|
||||
1
scripts_wip/Win_Power_Fastboot_Disable_Win10.ps1
Normal file
1
scripts_wip/Win_Power_Fastboot_Disable_Win10.ps1
Normal file
@@ -0,0 +1 @@
|
||||
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /V HiberbootEnabled /T REG_dWORD /D 1 /F
|
||||
2
scripts_wip/Win_Power_Mgmt_Disable_Lid_Sleep.bat
Normal file
2
scripts_wip/Win_Power_Mgmt_Disable_Lid_Sleep.bat
Normal file
@@ -0,0 +1,2 @@
|
||||
powercfg -setacvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
|
||||
powercfg -SetActive SCHEME_CURRENT
|
||||
2
scripts_wip/Win_Print_Spooler_Restart.bat
Normal file
2
scripts_wip/Win_Print_Spooler_Restart.bat
Normal file
@@ -0,0 +1,2 @@
|
||||
net stop "Print Spooler"
|
||||
net start "Print Spooler"
|
||||
8
scripts_wip/Win_Printers_Delete_Old_Jobs.ps1
Normal file
8
scripts_wip/Win_Printers_Delete_Old_Jobs.ps1
Normal file
@@ -0,0 +1,8 @@
|
||||
#Update with command parameters
|
||||
|
||||
$PrintJobs = get-wmiobject -class "Win32_PrintJob" -namespace "root\CIMV2" -computername . | Where-Object {[System.Management.ManagementDateTimeConverter]::ToDateTime($_.TimeSubmitted) -lt (Get-Date).AddDays(-2)}
|
||||
foreach ($job in $PrintJobs)
|
||||
{
|
||||
# Write-Host "Canceling job $($job.JobId)"
|
||||
$job.Delete()
|
||||
}
|
||||
7
scripts_wip/Win_Printers_Map_Network (needs fixing).bat
Normal file
7
scripts_wip/Win_Printers_Map_Network (needs fixing).bat
Normal file
@@ -0,0 +1,7 @@
|
||||
rundll32 printui.dll,PrintUIEntry /ga /n \\CAC-FILE-02\CAC-LAF-TXROOM
|
||||
rundll32 printui.dll,PrintUIEntry /ga /n \\CAC-FILE-02\CAC-WLF-PTR-01
|
||||
TIMEOUT 10
|
||||
net stop spooler
|
||||
TIMEOUT 10
|
||||
net start spooler
|
||||
exit /B
|
||||
4
scripts_wip/Win_Processes_Retrieve_Top.ps1
Normal file
4
scripts_wip/Win_Processes_Retrieve_Top.ps1
Normal file
@@ -0,0 +1,4 @@
|
||||
#Needs Command parameter updates
|
||||
|
||||
|
||||
Get-WmiObject Win32_PerfFormattedData_PerfProc_Process | ` where-object{ $_.Name -ne "_Total" -and $_.Name -ne "Idle"} | ` Sort-Object PercentProcessorTime -Descending | ` select -First 5 | ` Format-Table Name,IDProcess,PercentProcessorTime -AutoSize
|
||||
1
scripts_wip/Win_RDS_Logoff_Disconnected_Users.ps1
Normal file
1
scripts_wip/Win_RDS_Logoff_Disconnected_Users.ps1
Normal file
@@ -0,0 +1 @@
|
||||
quser | Select-String "Disc" | ForEach {logoff ($_.tostring() -split ' +')[2]}
|
||||
351
scripts_wip/Win_Reboot_Device_Upon_Users_Preferences.ps1
Normal file
351
scripts_wip/Win_Reboot_Device_Upon_Users_Preferences.ps1
Normal file
@@ -0,0 +1,351 @@
|
||||
#Reboot Device Upon The User’s Preferences: Wait, reboot at 18:00 or reboot now. The prompt mesage and colors can be changed upon your choice
|
||||
|
||||
|
||||
$days = 7
|
||||
$system = Get-WmiObject win32_operatingsystem
|
||||
|
||||
if($system.ConvertToDateTime($system.LastBootUpTime) -lt (Get-Date).AddDays(-$days)){
|
||||
#----------------------------------------------
|
||||
#region Import Assemblies
|
||||
#----------------------------------------------
|
||||
[void][Reflection.Assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
|
||||
[void][Reflection.Assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
|
||||
[void][Reflection.Assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
|
||||
#endregion Import Assemblies
|
||||
|
||||
|
||||
#Define a Param block to use custom parameters in the project
|
||||
#Param ($CustomParameter)
|
||||
|
||||
function Main {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
The Main function starts the project application.
|
||||
|
||||
.PARAMETER Commandline
|
||||
$Commandline contains the complete argument string passed to the script packager executable.
|
||||
|
||||
.NOTES
|
||||
Use this function to initialize your script and to call GUI forms.
|
||||
|
||||
.NOTES
|
||||
To get the console output in the Packager (Forms Engine) use:
|
||||
$ConsoleOutput (Type: System.Collections.ArrayList)
|
||||
#>
|
||||
Param ([String]$Commandline)
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
#TODO: Add initialization script here (Load modules and check requirements)
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
if((Call-MainForm_psf) -eq 'OK')
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
$global:ExitCode = 0 #Set the exit code for the Packager
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion Source: Startup.pss
|
||||
|
||||
#region Source: MainForm.psf
|
||||
function Call-MainForm_psf
|
||||
{
|
||||
|
||||
#----------------------------------------------
|
||||
#region Import the Assemblies
|
||||
#----------------------------------------------
|
||||
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
|
||||
[void][reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
|
||||
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
|
||||
#endregion Import Assemblies
|
||||
|
||||
#----------------------------------------------
|
||||
#region Generated Form Objects
|
||||
#----------------------------------------------
|
||||
[System.Windows.Forms.Application]::EnableVisualStyles()
|
||||
$MainForm = New-Object 'System.Windows.Forms.Form'
|
||||
$panel2 = New-Object 'System.Windows.Forms.Panel'
|
||||
$ButtonCancel = New-Object 'System.Windows.Forms.Button'
|
||||
$ButtonSchedule = New-Object 'System.Windows.Forms.Button'
|
||||
$ButtonRestartNow = New-Object 'System.Windows.Forms.Button'
|
||||
$panel1 = New-Object 'System.Windows.Forms.Panel'
|
||||
$labelITSystemsMaintenance = New-Object 'System.Windows.Forms.Label'
|
||||
$labelSecondsLeftToRestart = New-Object 'System.Windows.Forms.Label'
|
||||
$labelTime = New-Object 'System.Windows.Forms.Label'
|
||||
$labelInOrderToApplySecuri = New-Object 'System.Windows.Forms.Label'
|
||||
$timerUpdate = New-Object 'System.Windows.Forms.Timer'
|
||||
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
|
||||
#endregion Generated Form Objects
|
||||
|
||||
#----------------------------------------------
|
||||
# User Generated Script
|
||||
#----------------------------------------------
|
||||
$TotalTime = 1500 #in seconds
|
||||
|
||||
$MainForm_Load={
|
||||
#TODO: Initialize Form Controls here
|
||||
$labelTime.Text = "{0:D2}" -f $TotalTime #$TotalTime
|
||||
#Add TotalTime to current time
|
||||
$script:StartTime = (Get-Date).AddSeconds($TotalTime)
|
||||
#Start the timer
|
||||
$timerUpdate.Start()
|
||||
}
|
||||
|
||||
|
||||
$timerUpdate_Tick={
|
||||
# Define countdown timer
|
||||
[TimeSpan]$span = $script:StartTime - (Get-Date)
|
||||
#Update the display
|
||||
$labelTime.Text = "{0:N0}" -f $span.TotalSeconds
|
||||
$timerUpdate.Start()
|
||||
if ($span.TotalSeconds -le 0)
|
||||
{
|
||||
$timerUpdate.Stop()
|
||||
Restart-Computer -Force
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$ButtonRestartNow_Click = {
|
||||
# Restart the computer immediately
|
||||
Restart-Computer -Force
|
||||
}
|
||||
|
||||
$ButtonSchedule_Click={
|
||||
# Schedule restart for 6pm
|
||||
if(Get-ScheduledTask -TaskName "auto shutdown my computer" -ErrorAction SilentlyContinue){Get-ScheduledTask -TaskName "auto shutdown my computer" | Unregister-ScheduledTask -Confirm:$false}
|
||||
if((schtasks /create /sc once /tn "auto shutdown my computer" /tr "shutdown /r /d p:1:1 /c 'Initiating reboot since the device has not been rebooted for 7 days'" /st 18:00) -like "*Success*"){
|
||||
$SetT=Get-ScheduledTask -TaskName "auto shutdown my computer"
|
||||
$SetT.Triggers[0].EndBoundary=[DateTime]::Now.Date.ToString("yyyy-MM-dd")+"T"+"19:00:00"
|
||||
$SetT.Settings.DeleteExpiredTaskAfter ='PT0S'
|
||||
Set-ScheduledTask -InputObject $SetT
|
||||
}
|
||||
$MainForm.Close()
|
||||
}
|
||||
|
||||
$ButtonCancel_Click={
|
||||
#TODO: Place custom script here
|
||||
$MainForm.Close()
|
||||
}
|
||||
|
||||
$labelITSystemsMaintenance_Click={
|
||||
#TODO: Place custom script here
|
||||
|
||||
}
|
||||
|
||||
$panel2_Paint=[System.Windows.Forms.PaintEventHandler]{
|
||||
#Event Argument: $_ = [System.Windows.Forms.PaintEventArgs]
|
||||
#TODO: Place custom script here
|
||||
|
||||
}
|
||||
|
||||
$labelTime_Click={
|
||||
#TODO: Place custom script here
|
||||
|
||||
}
|
||||
# --End User Generated Script--
|
||||
#----------------------------------------------
|
||||
#region Generated Events
|
||||
#----------------------------------------------
|
||||
|
||||
$Form_StateCorrection_Load=
|
||||
{
|
||||
#Correct the initial state of the form to prevent the .Net maximized form issue
|
||||
$MainForm.WindowState = $InitialFormWindowState
|
||||
}
|
||||
|
||||
$Form_StoreValues_Closing=
|
||||
{
|
||||
#Store the control values
|
||||
}
|
||||
|
||||
|
||||
$Form_Cleanup_FormClosed=
|
||||
{
|
||||
#Remove all event handlers from the controls
|
||||
try
|
||||
{
|
||||
$ButtonCancel.remove_Click($buttonCancel_Click)
|
||||
$ButtonSchedule.remove_Click($ButtonSchedule_Click)
|
||||
$ButtonRestartNow.remove_Click($ButtonRestartNow_Click)
|
||||
$panel2.remove_Paint($panel2_Paint)
|
||||
$labelITSystemsMaintenance.remove_Click($labelITSystemsMaintenance_Click)
|
||||
$labelTime.remove_Click($labelTime_Click)
|
||||
$MainForm.remove_Load($MainForm_Load)
|
||||
$timerUpdate.remove_Tick($timerUpdate_Tick)
|
||||
$MainForm.remove_Load($Form_StateCorrection_Load)
|
||||
$MainForm.remove_Closing($Form_StoreValues_Closing)
|
||||
$MainForm.remove_FormClosed($Form_Cleanup_FormClosed)
|
||||
}
|
||||
catch [Exception]
|
||||
{ }
|
||||
}
|
||||
#endregion Generated Events
|
||||
|
||||
#----------------------------------------------
|
||||
#region Generated Form Code
|
||||
#----------------------------------------------
|
||||
$MainForm.SuspendLayout()
|
||||
$panel2.SuspendLayout()
|
||||
$panel1.SuspendLayout()
|
||||
#
|
||||
# MainForm
|
||||
#
|
||||
$MainForm.Controls.Add($panel2)
|
||||
$MainForm.Controls.Add($panel1)
|
||||
$MainForm.Controls.Add($labelSecondsLeftToRestart)
|
||||
$MainForm.Controls.Add($labelTime)
|
||||
$MainForm.Controls.Add($labelInOrderToApplySecuri)
|
||||
$MainForm.AutoScaleDimensions = '6, 13'
|
||||
$MainForm.AutoScaleMode = 'Font'
|
||||
$MainForm.BackColor = 'White'
|
||||
$MainForm.ClientSize = '373, 279'
|
||||
$MainForm.MaximizeBox = $False
|
||||
$MainForm.MinimizeBox = $False
|
||||
$MainForm.Name = 'MainForm'
|
||||
$MainForm.ShowIcon = $False
|
||||
$MainForm.ShowInTaskbar = $False
|
||||
$MainForm.StartPosition = 'CenterScreen'
|
||||
$MainForm.Text = 'MSP Name'
|
||||
$MainForm.TopMost = $True
|
||||
$MainForm.add_Load($MainForm_Load)
|
||||
#
|
||||
# panel2
|
||||
#
|
||||
$panel2.Controls.Add($ButtonCancel)
|
||||
$panel2.Controls.Add($ButtonSchedule)
|
||||
$panel2.Controls.Add($ButtonRestartNow)
|
||||
$panel2.BackColor = 'ScrollBar'
|
||||
$panel2.Location = '0, 205'
|
||||
$panel2.Name = 'panel2'
|
||||
$panel2.Size = '378, 80'
|
||||
$panel2.TabIndex = 9
|
||||
$panel2.add_Paint($panel2_Paint)
|
||||
#
|
||||
# ButtonCancel
|
||||
#
|
||||
$ButtonCancel.Location = '250, 17'
|
||||
$ButtonCancel.Name = 'ButtonCancel'
|
||||
$ButtonCancel.Size = '77, 45'
|
||||
$ButtonCancel.TabIndex = 7
|
||||
$ButtonCancel.Text = 'Wait'
|
||||
$ButtonCancel.UseVisualStyleBackColor = $True
|
||||
$ButtonCancel.add_Click($buttonCancel_Click)
|
||||
#
|
||||
# ButtonSchedule
|
||||
#
|
||||
$ButtonSchedule.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
|
||||
$ButtonSchedule.Location = '139, 17'
|
||||
$ButtonSchedule.Name = 'ButtonSchedule'
|
||||
$ButtonSchedule.Size = '105, 45'
|
||||
$ButtonSchedule.TabIndex = 6
|
||||
$ButtonSchedule.Text = 'Reboot at 18:00'
|
||||
$ButtonSchedule.UseVisualStyleBackColor = $True
|
||||
$ButtonSchedule.add_Click($ButtonSchedule_Click)
|
||||
#
|
||||
# ButtonRestartNow
|
||||
#
|
||||
$ButtonRestartNow.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
|
||||
$ButtonRestartNow.ForeColor = 'DarkRed'
|
||||
$ButtonRestartNow.Location = '42, 17'
|
||||
$ButtonRestartNow.Name = 'ButtonRestartNow'
|
||||
$ButtonRestartNow.Size = '91, 45'
|
||||
$ButtonRestartNow.TabIndex = 0
|
||||
$ButtonRestartNow.Text = 'Reboot'
|
||||
$ButtonRestartNow.UseVisualStyleBackColor = $True
|
||||
$ButtonRestartNow.add_Click($ButtonRestartNow_Click)
|
||||
#
|
||||
# panel1
|
||||
#
|
||||
$panel1.Controls.Add($labelITSystemsMaintenance)
|
||||
$panel1.BackColor = '22, 54, 36'
|
||||
$panel1.Location = '0, 0'
|
||||
$panel1.Name = 'panel1'
|
||||
$panel1.Size = '375, 67'
|
||||
$panel1.TabIndex = 8
|
||||
#
|
||||
# labelITSystemsMaintenance
|
||||
#
|
||||
$labelITSystemsMaintenance.Font = 'Microsoft Sans Serif, 14.25pt'
|
||||
$labelITSystemsMaintenance.ForeColor = 'White'
|
||||
$labelITSystemsMaintenance.Location = '11, 18'
|
||||
$labelITSystemsMaintenance.Name = 'labelITSystemsMaintenance'
|
||||
$labelITSystemsMaintenance.Size = '269, 23'
|
||||
$labelITSystemsMaintenance.TabIndex = 1
|
||||
$labelITSystemsMaintenance.Text = 'MSP Name'
|
||||
$labelITSystemsMaintenance.TextAlign = 'MiddleLeft'
|
||||
$labelITSystemsMaintenance.add_Click($labelITSystemsMaintenance_Click)
|
||||
#
|
||||
# labelSecondsLeftToRestart
|
||||
#
|
||||
$labelSecondsLeftToRestart.AutoSize = $True
|
||||
$labelSecondsLeftToRestart.Font = 'Microsoft Sans Serif, 9pt, style=Bold'
|
||||
$labelSecondsLeftToRestart.Location = '87, 176'
|
||||
$labelSecondsLeftToRestart.Name = 'labelSecondsLeftToRestart'
|
||||
$labelSecondsLeftToRestart.Size = '155, 15'
|
||||
$labelSecondsLeftToRestart.TabIndex = 5
|
||||
$labelSecondsLeftToRestart.Text = 'Seconds to reboot :'
|
||||
#
|
||||
# labelTime
|
||||
#
|
||||
$labelTime.AutoSize = $True
|
||||
$labelTime.Font = 'Microsoft Sans Serif, 9pt, style=Bold'
|
||||
$labelTime.ForeColor = '192, 0, 0'
|
||||
$labelTime.Location = '237, 176'
|
||||
$labelTime.Name = 'labelTime'
|
||||
$labelTime.Size = '43, 15'
|
||||
$labelTime.TabIndex = 3
|
||||
$labelTime.Text = '00:60'
|
||||
$labelTime.TextAlign = 'MiddleCenter'
|
||||
$labelTime.add_Click($labelTime_Click)
|
||||
#
|
||||
# labelInOrderToApplySecuri
|
||||
#
|
||||
$labelInOrderToApplySecuri.Font = 'Microsoft Sans Serif, 9pt'
|
||||
$labelInOrderToApplySecuri.Location = '12, 84'
|
||||
$labelInOrderToApplySecuri.Name = 'labelInOrderToApplySecuri'
|
||||
$labelInOrderToApplySecuri.Size = '350, 83'
|
||||
$labelInOrderToApplySecuri.TabIndex = 2
|
||||
$labelInOrderToApplySecuri.Text = 'Every 7 days your PC should be restarted for maintenance and updates.
|
||||
|
||||
If this does not fit, you can press wait or restart at. 6:00 p.m.'
|
||||
#
|
||||
# timerUpdate
|
||||
#
|
||||
$timerUpdate.add_Tick($timerUpdate_Tick)
|
||||
$panel1.ResumeLayout()
|
||||
$panel2.ResumeLayout()
|
||||
$MainForm.ResumeLayout()
|
||||
#endregion Generated Form Code
|
||||
|
||||
#----------------------------------------------
|
||||
|
||||
#Save the initial state of the form
|
||||
$InitialFormWindowState = $MainForm.WindowState
|
||||
#Init the OnLoad event to correct the initial state of the form
|
||||
$MainForm.add_Load($Form_StateCorrection_Load)
|
||||
#Clean up the control events
|
||||
$MainForm.add_FormClosed($Form_Cleanup_FormClosed)
|
||||
#Store the control values when form is closing
|
||||
$MainForm.add_Closing($Form_StoreValues_Closing)
|
||||
#Show the Form
|
||||
return $MainForm.ShowDialog()
|
||||
|
||||
}
|
||||
#endregion Source: MainForm.psf
|
||||
|
||||
#Start the application
|
||||
Main ($CommandLine)
|
||||
}else{
|
||||
Write-Host "Machine was rebooted less than $days days ago"
|
||||
|
||||
}
|
||||
2432
scripts_wip/Win_Reclaim_Windows_10.ps1
Normal file
2432
scripts_wip/Win_Reclaim_Windows_10.ps1
Normal file
File diff suppressed because it is too large
Load Diff
7
scripts_wip/Win_Repair_DomainTrust.ps1
Normal file
7
scripts_wip/Win_Repair_DomainTrust.ps1
Normal file
@@ -0,0 +1,7 @@
|
||||
###
|
||||
# Author: Dave Long <dlong@cagedata.com>
|
||||
# Tests and attempts to repair the domain trust relationship between a domain
|
||||
# joined computer and the domain.
|
||||
###
|
||||
|
||||
Test-ComputerSecureChannel -Repair
|
||||
30
scripts_wip/Win_Retrieve_Backup_Windows_Logs.bat
Normal file
30
scripts_wip/Win_Retrieve_Backup_Windows_Logs.bat
Normal file
@@ -0,0 +1,30 @@
|
||||
rem Script starts here
|
||||
rem Timestamp Generator
|
||||
rem Needs parameter support
|
||||
|
||||
set BACKUP_PATH=D:\logs
|
||||
|
||||
rem Parse the date (e.g., Thu 02/28/2013)
|
||||
set cur_yyyy=%date:~10,4%
|
||||
set cur_mm=%date:~4,2%
|
||||
set cur_dd=%date:~7,2%
|
||||
|
||||
rem Parse the time (e.g., 11:20:56.39)
|
||||
set cur_hh=%time:~0,2%
|
||||
if %cur_hh% lss 10 (set cur_hh=0%time:~1,1%)
|
||||
set cur_nn=%time:~3,2%
|
||||
set cur_ss=%time:~6,2%
|
||||
set cur_ms=%time:~9,2%
|
||||
|
||||
rem Set the timestamp format
|
||||
set timestamp=%cur_yyyy%%cur_mm%%cur_dd%-%cur_hh%%cur_nn%%cur_ss%%cur_ms%
|
||||
|
||||
wevtutil epl System %BACKUP_PATH%\system_%timestamp%.evtx
|
||||
wevtutil epl Application %BACKUP_PATH%\application_%timestamp%.evtx
|
||||
wevtutil epl Security %BACKUP_PATH%\security_%timestamp%.evtx
|
||||
wevtutil epl Setup %BACKUP_PATH%\system_%timestamp%.evtx
|
||||
wevtutil epl Forwarded Events %BACKUP_PATH%\system_%timestamp%.evtx
|
||||
wevtutil epl Active Directory Web Services %BACKUP_PATH%\system_%timestamp%.evtx
|
||||
wevtutil epl Hardware Events %BACKUP_PATH%\system_%timestamp%.evtx
|
||||
|
||||
rem End of Script
|
||||
1
scripts_wip/Win_Retrieve_Startup_Apps_List.ps1
Normal file
1
scripts_wip/Win_Retrieve_Startup_Apps_List.ps1
Normal file
@@ -0,0 +1 @@
|
||||
Get-CimInstance Win32_StartupCommand | Select-Object Name, command, Location, User | Format-List
|
||||
23
scripts_wip/Win_Software_Autoruns_Get.ps1
Normal file
23
scripts_wip/Win_Software_Autoruns_Get.ps1
Normal file
@@ -0,0 +1,23 @@
|
||||
###
|
||||
# Author: Dave Long <dlong@cagedata.com>
|
||||
# Uses Autoruns from Sysinternals to get all automatically running programs on PCs.
|
||||
# Also tests autoruns against Virtus Total and shows how many AV programs detect
|
||||
# each autorun as a virus.
|
||||
#
|
||||
# Running assumes acceptance of the Sysinternals and Virus Total licenses.
|
||||
###
|
||||
|
||||
$AutorunsUrl = "https://download.sysinternals.com/files/Autoruns.zip"
|
||||
$AutorunsOut = Join-Path $env:TEMP "Autoruns.zip"
|
||||
$Autoruns = Join-Path $env:TEMP "Autoruns"
|
||||
$OutputFile = Join-Path $Autoruns "autoruns.csv"
|
||||
|
||||
Invoke-WebRequest -Uri $AutorunsUrl -OutFile $AutorunsOut
|
||||
|
||||
Expand-Archive -Path $AutorunsOut -DestinationPath $Autoruns
|
||||
|
||||
Start-Process -Wait -FilePath $Autoruns/autorunsc.exe -NoNewWindow -PassThru -ArgumentList @("-v", "-vt", "-c", "-o $OutputFile")
|
||||
|
||||
Import-Csv -Path $OutputFile
|
||||
|
||||
Write-Host "Complete Autoruns output stored at $OutputFile"
|
||||
3
scripts_wip/Win_Software_Installed_List.ps1
Normal file
3
scripts_wip/Win_Software_Installed_List.ps1
Normal file
@@ -0,0 +1,3 @@
|
||||
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Format-Table PSChildName, DisplayName, Publisher, DisplayVersion, Version, UninstallString
|
||||
|
||||
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Format-Table PSChildName, DisplayName, Publisher, DisplayVersion, Version, UninstallString
|
||||
36
scripts_wip/Win_Store_Uninstall_Builtin_Apps.ps1
Normal file
36
scripts_wip/Win_Store_Uninstall_Builtin_Apps.ps1
Normal file
@@ -0,0 +1,36 @@
|
||||
# Uninstall 3D Builder:
|
||||
Get-AppxPackage *3dbuilder* | Remove-AppxPackage
|
||||
# Uninstall Alarms and Clock:
|
||||
Get-AppxPackage *windowsalarms* | Remove-AppxPackage
|
||||
# Uninstall Camera:
|
||||
Get-AppxPackage *windowscamera* | Remove-AppxPackage
|
||||
# Uninstall Get Office:
|
||||
Get-AppxPackage *officehub* | Remove-AppxPackage
|
||||
# Uninstall Get Skype:
|
||||
Get-AppxPackage *skypeapp* | Remove-AppxPackage
|
||||
# Uninstall Get Started:
|
||||
Get-AppxPackage *getstarted* | Remove-AppxPackage
|
||||
# Uninstall Groove Music:
|
||||
Get-AppxPackage *zunemusic* | Remove-AppxPackage
|
||||
# Uninstall Maps:
|
||||
Get-AppxPackage *windowsmaps* | Remove-AppxPackage
|
||||
#Uninstall Microsoft Solitaire Collection:
|
||||
Get-AppxPackage *solitairecollection* | Remove-AppxPackage
|
||||
# Uninstall Money:
|
||||
Get-AppxPackage *bingfinance* | Remove-AppxPackage
|
||||
# Uninstall Movies & TV:
|
||||
Get-AppxPackage *zunevideo* | Remove-AppxPackage
|
||||
# Uninstall News:
|
||||
Get-AppxPackage *bingnews* | Remove-AppxPackage
|
||||
# Uninstall People:
|
||||
Get-AppxPackage *people* | Remove-AppxPackage
|
||||
# Uninstall Phone Companion:
|
||||
Get-AppxPackage *windowsphone* | Remove-AppxPackage
|
||||
# Uninstall Store:
|
||||
Get-AppxPackage *windowsstore* | Remove-AppxPackage
|
||||
# Uninstall Sports:
|
||||
Get-AppxPackage *bingsports* | Remove-AppxPackage
|
||||
# Uninstall Voice Recorder:
|
||||
Get-AppxPackage *soundrecorder* | Remove-AppxPackage
|
||||
# Uninstall Weather:
|
||||
Get-AppxPackage *bingweather* | Remove-AppxPackage
|
||||
12
scripts_wip/Win_Suggested_Apps_Disable.ps1
Normal file
12
scripts_wip/Win_Suggested_Apps_Disable.ps1
Normal file
@@ -0,0 +1,12 @@
|
||||
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
|
||||
$Name = "DisableWindowsConsumerFeatures "
|
||||
$value = "1"
|
||||
|
||||
IF(!(Test-Path $registryPath))
|
||||
{
|
||||
New-Item -Path $registryPath -Force | Out-Null
|
||||
New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null
|
||||
}
|
||||
ELSE {
|
||||
New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null
|
||||
}
|
||||
1
scripts_wip/Win_System_Restore_Enable.bat
Normal file
1
scripts_wip/Win_System_Restore_Enable.bat
Normal file
@@ -0,0 +1 @@
|
||||
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" /v SystemRestorePointCreationFrequency /t REG_DWORD /d 0
|
||||
6
scripts_wip/Win_System_Restore_Point_Create.ps1
Normal file
6
scripts_wip/Win_System_Restore_Point_Create.ps1
Normal file
@@ -0,0 +1,6 @@
|
||||
#Needs updating to include date
|
||||
#Needs System Restore Size adjusting (50GB or 20% disk space)
|
||||
|
||||
|
||||
Checkpoint-Computer -Description "Weekly Maintanence" -RestorePointType "MODIFY_SETTINGS"
|
||||
Write-Host "System Restore Point created successfully"
|
||||
31
scripts_wip/Win_Teams_Uninstall.ps1
Normal file
31
scripts_wip/Win_Teams_Uninstall.ps1
Normal file
@@ -0,0 +1,31 @@
|
||||
<#
|
||||
From https://www.reddit.com/r/sysadmin/comments/aq72e4/microsoft_teams_wont_stay_uninstalled/
|
||||
.SYNOPSIS
|
||||
This script allows you to uninstall the Microsoft Teams app and remove Teams directory for a user.
|
||||
.DESCRIPTION
|
||||
Use this script to clear the installed Microsoft Teams application. Run this PowerShell script for each user profile for which the Teams App was installed on a machine. After the PowerShell has executed on all user profiles, Teams can be redeployed.
|
||||
#>
|
||||
|
||||
$TeamsPath = [System.IO.Path]::Combine($env:LOCALAPPDATA, 'Microsoft', 'Teams')
|
||||
$TeamsUpdateExePath = [System.IO.Path]::Combine($env:LOCALAPPDATA, 'Microsoft', 'Teams', 'Update.exe')
|
||||
|
||||
try
|
||||
{
|
||||
if (Test-Path -Path $TeamsUpdateExePath) {
|
||||
Write-Host "Uninstalling Teams process"
|
||||
|
||||
# Uninstall app
|
||||
$proc = Start-Process -FilePath $TeamsUpdateExePath -ArgumentList "-uninstall -s" -PassThru
|
||||
$proc.WaitForExit()
|
||||
}
|
||||
if (Test-Path -Path $TeamsPath) {
|
||||
Write-Host "Deleting Teams directory"
|
||||
Remove-Item -Path $TeamsPath -Recurse
|
||||
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Error -ErrorRecord $_
|
||||
exit /b 1
|
||||
}
|
||||
17
scripts_wip/Win_Teamviewer_Get_ID.ps1
Normal file
17
scripts_wip/Win_Teamviewer_Get_ID.ps1
Normal file
@@ -0,0 +1,17 @@
|
||||
# Retrieve Teamviewer ID from TRMM agent
|
||||
|
||||
$clientId = Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\TeamViewer -Name ClientID -ErrorAction SilentlyContinue
|
||||
|
||||
If (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\TeamViewer' -Name ClientID -ErrorAction SilentlyContinue) {
|
||||
|
||||
Write-Output $clientid.Clientid
|
||||
exit 0
|
||||
|
||||
}
|
||||
Else {
|
||||
|
||||
Write-Output 'Teamviewer is not installed.'
|
||||
exit 1
|
||||
}
|
||||
|
||||
Exit $LASTEXITCODE
|
||||
2
scripts_wip/Win_Teamviewer_Uninstall.bat
Normal file
2
scripts_wip/Win_Teamviewer_Uninstall.bat
Normal file
@@ -0,0 +1,2 @@
|
||||
net stop TeamViewer
|
||||
"%programfiles(x86)%\TeamViewer\uninstall.exe" /S
|
||||
7
scripts_wip/Win_Upgrade_Win7_to_Win10.ps1
Normal file
7
scripts_wip/Win_Upgrade_Win7_to_Win10.ps1
Normal file
@@ -0,0 +1,7 @@
|
||||
$dir = "c:\temp"
|
||||
mkdir $dir
|
||||
$webClient = New-Object System.Net.WebClient
|
||||
$url = "https://go.microsoft.com/fwlink/?LinkID=799445"
|
||||
$file = "$($dir)\Win10Upgrade.exe"
|
||||
$webClient.DownloadFile($url,$file)
|
||||
Start-Process -FilePath $file -ArgumentList "/quietinstall /skipeula /auto upgrade /copylogs $dir" -verb runas
|
||||
5
scripts_wip/Win_Users_Admin_Account_Rename.ps1
Normal file
5
scripts_wip/Win_Users_Admin_Account_Rename.ps1
Normal file
@@ -0,0 +1,5 @@
|
||||
#Needs random name
|
||||
#Needs parameter support
|
||||
|
||||
|
||||
Rename-LocalUser -Name "Administrator" -NewName "LocalAdmin"
|
||||
22
scripts_wip/Win_Users_Admins_List_Local.ps1
Normal file
22
scripts_wip/Win_Users_Admins_List_Local.ps1
Normal file
@@ -0,0 +1,22 @@
|
||||
Write-Output ("Members of Administrators on " + (hostname) + ":")
|
||||
|
||||
try {
|
||||
# the Get-LocalGroupMember cmdlet will get a list of local admins for us, but, there are some bugs in the code and so in some cases, like if there are AzureAD accounts in the local admins group, it will fail, thus we can fall back to using net localgroup
|
||||
$admins = Get-LocalGroupMember -Group "Administrators" -ErrorAction Stop # erroraction stop so that we can break out of this try and go to catch in case the cmdlet fails
|
||||
ForEach ($admin in $admins) {
|
||||
if ($admin.PrincipalSource.ToString() -eq "Local") { # if it's a local account, we can check if the account is enabled
|
||||
$enabled = (Get-LocalUser -Name ($admin.Name -Split "\\")[1]).Enabled # split the computername, etc off the front of the username and use Get-LocalUser to check if enabled
|
||||
Write-Output ($admin.Name + " (Account Enabled: " + $enabled + ")")
|
||||
} else {
|
||||
Write-Output ($admin.Name + " (Unable to check if enabled, source is " + $admin.PrincipalSource + ")") # if it isn't a local account, just like the source along with it
|
||||
}
|
||||
}
|
||||
} catch { # fall back to listing with net localgroup if Get-LocalGroupMember fails
|
||||
write-output ("Get-LocalGroupMember failed, falling back to net localgroup Administrators")
|
||||
$admins = net localgroup "Administrators"
|
||||
$length = $admins.length
|
||||
$admins = $admins[6..($length - 3)]
|
||||
ForEach ($admin in $admins) {
|
||||
Get-LocalUser -Name $admin
|
||||
}
|
||||
}
|
||||
1
scripts_wip/Win_VPN_L2TP_Win10_Fix.bat
Normal file
1
scripts_wip/Win_VPN_L2TP_Win10_Fix.bat
Normal file
@@ -0,0 +1 @@
|
||||
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\PolicyAgent /v AssumeUDPEncapsulationContextOnSendRule /t REG_DWORD /d 0x2 /f
|
||||
2
scripts_wip/Win_VSS_Delete_ShadowCopies.ps1
Normal file
2
scripts_wip/Win_VSS_Delete_ShadowCopies.ps1
Normal file
@@ -0,0 +1,2 @@
|
||||
Vssadmin delete shadows
|
||||
#Deletes volume shadow copies
|
||||
2
scripts_wip/Win_VSS_List_Providers.ps1
Normal file
2
scripts_wip/Win_VSS_List_Providers.ps1
Normal file
@@ -0,0 +1,2 @@
|
||||
Vssadmin list providers
|
||||
#List registered volume shadow copy providers
|
||||
2
scripts_wip/Win_VSS_List_ShadowCopy_Writers.ps1
Normal file
2
scripts_wip/Win_VSS_List_ShadowCopy_Writers.ps1
Normal file
@@ -0,0 +1,2 @@
|
||||
Vssadmin list writers
|
||||
#List subscribed volume shadow copy writers
|
||||
2
scripts_wip/Win_VSS_List_Shadow_Copies.ps1
Normal file
2
scripts_wip/Win_VSS_List_Shadow_Copies.ps1
Normal file
@@ -0,0 +1,2 @@
|
||||
Vssadmin list shadows
|
||||
#List existing volume shadow copies
|
||||
13
scripts_wip/Win_Veeam_Backup_Script_Notification.ps1
Normal file
13
scripts_wip/Win_Veeam_Backup_Script_Notification.ps1
Normal file
@@ -0,0 +1,13 @@
|
||||
Import-Module $env:SyncroModule
|
||||
|
||||
# Create RMMAlerts when a backup fails
|
||||
|
||||
$event = Get-EventLog "Veeam Backup" -newest 1 -After (Get-Date).AddDays(-1)| Where-Object {$_.EventID -eq 0}
|
||||
|
||||
if($event.entrytype -eq "Error") {
|
||||
write-host "We got an event that is an error from Veeam Backup!"
|
||||
Rmm-Alert -Category "veeam_backup_failed" -Body "Veeam Backup Failed on $(%computername%) - message: $($event.message)"
|
||||
} else {
|
||||
write-host "No errors here"
|
||||
}
|
||||
|
||||
12
scripts_wip/Win_WSUS_Clear_And_Restart.bat
Normal file
12
scripts_wip/Win_WSUS_Clear_And_Restart.bat
Normal file
@@ -0,0 +1,12 @@
|
||||
net stop wuauserv
|
||||
net stop cryptSvc
|
||||
net stop bits
|
||||
net stop msiserver
|
||||
timeout 1
|
||||
Ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
|
||||
Ren C:\Windows\System32\catroot2 Catroot2.old
|
||||
timeout 1
|
||||
net start wuauserv
|
||||
net start cryptSvc
|
||||
net start bits
|
||||
net start msiserver
|
||||
3
scripts_wip/Win_Wifi_SSID_and_Password_Retrieval.ps1
Normal file
3
scripts_wip/Win_Wifi_SSID_and_Password_Retrieval.ps1
Normal file
@@ -0,0 +1,3 @@
|
||||
# Query Windows 10 Saved SSID details outputs the WIFI name and password.
|
||||
# Created by TechCentre with the help and assistance of the internet
|
||||
(netsh wlan show profiles) | Select-String "\:(.+)$" | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name="$name" key=clear)} | Select-String "Key Content\W+\:(.+)$" | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | Format-Table -AutoSize
|
||||
1
scripts_wip/Win_Wifi_SSID_and_Password_Retrievalv2.ps1
Normal file
1
scripts_wip/Win_Wifi_SSID_and_Password_Retrievalv2.ps1
Normal file
@@ -0,0 +1 @@
|
||||
(netsh wlan show profiles) | Select-String "\:(.+)$" | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name="$name" key=clear)} | Select-String "Key Content\W+\:(.+)$" | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | Format-Table -AutoSize
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user