community script updates

This commit is contained in:
silversword411 2021-06-17 15:27:40 -04:00
parent dfd01df5ba
commit 9f9ecc521f
No known key found for this signature in database
GPG Key ID: 6F4BD176F56B50CA
3 changed files with 79 additions and 7 deletions

View File

@ -8,7 +8,6 @@
"shell": "powershell",
"category": "TRMM (Win):Browsers",
"default_timeout": "300"
},
{
"guid": "3ff6a386-11d1-4f9d-8cca-1b0563bb6443",
@ -38,7 +37,7 @@
"description": "This script installs Duplicati 2.0.5.1 as a service.",
"shell": "powershell",
"category": "TRMM (Win):3rd Party Software",
"default_timeout": "300"
"default_timeout": "300"
},
{
"guid": "81cc5bcb-01bf-4b0c-89b9-0ac0f3fe0c04",
@ -48,7 +47,7 @@
"description": "This script will reset all of the Windows Updates components to DEFAULT SETTINGS.",
"shell": "powershell",
"category": "TRMM (Win):Updates",
"default_timeout": "300"
"default_timeout": "300"
},
{
"guid": "8db87ff0-a9b4-4d9d-bc55-377bbcb85b6d",
@ -58,7 +57,7 @@
"description": "Cleans the C: drive's Window Temperary files, Windows SoftwareDistribution folder, the local users Temperary folder, IIS logs (if applicable) and empties the recycling bin. All deleted files will go into a log transcript in $env:TEMP. By default this script leaves files that are newer than 7 days old however this variable can be edited.",
"shell": "powershell",
"category": "TRMM (Win):Maintenance",
"default_timeout": "25000"
"default_timeout": "25000"
},
{
"guid": "2f28e8c1-ae0f-4b46-a826-f513974526a3",
@ -279,7 +278,7 @@
"submittedBy": "https://github.com/unplugged216",
"name": "ADDS - Direcotry documentation in Hudu",
"description": "Auto generates ADDS documentation and submits it to your Hudu instance.",
"args": [
"args": [
"-ClientName {{client.name}}",
"-HuduBaseDomain {{global.HuduBaseDomain}}",
"-HuduApiKey {{global.HuduApiKey}}"
@ -640,9 +639,18 @@
"shell": "powershell",
"category": "TRMM (Win):Storage"
},
{
"guid": "6a52f495-d43e-40f4-91a9-bbe4f578e6d1",
"filename": "Win_User_Create.ps1",
"submittedBy": "https://github.com/brodur",
"name": "Create Local User",
"description": "Create a local user. Parameters are: username, password and optional: description, fullname, group (adds to Users if not specified)",
"shell": "powershell",
"category": "TRMM (Win):Other"
},
{
"guid": "57997ec7-b293-4fd5-9f90-a25426d0eb90",
"filename": "Win_Get_Computer_Users.ps1",
"filename": "Win_Users_List.ps1",
"submittedBy": "https://github.com/tremor021",
"name": "Get Computer Users",
"description": "Get list of computer users and show which one is enabled",
@ -697,4 +705,4 @@
"category": "TRMM (Win):Misc>Reference",
"default_timeout": "1"
}
]
]

View File

@ -0,0 +1,64 @@
<#
.SYNOPSIS
Creates Local User on computer
.DESCRIPTION
Creates a Local user with password and adds to Users group. If group specificed you can add to a different group
.OUTPUTS
Results are printed to the console.
.EXAMPLE
In parameter set desired items
-username testuser -password password -description "Big Bozz" -group administrators
.NOTES
Change Log
6/17/2021 V1.0 Initial release
6/17/2021 v1.1 Adding group support
Contributed by: https://github.com/brodur
Tweaks by: https://github.com/silversword411
#>
param(
$username,
$password,
$description = "User added by TacticalRMM",
$fullname = "",
$group
)
if ([string]::IsNullOrEmpty($username)) {
Write-Output "Username must be defined. Use -username <value> to pass it."
EXIT 1
}
if ([string]::IsNullOrEmpty($password)) {
Write-Output "Password must be defined. Use -password <value> to pass it."
EXIT 1
}
else {
$password = ConvertTo-SecureString -String $password -AsPlainText -Force
}
try {
New-LocalUser -Name $username -Password $password -Description $description -PasswordNeverExpires -FullName $fullname
if ([string]::IsNullOrEmpty($group)) {
Add-LocalGroupMember -Group "Users" -Member $username
Write-Output "Adding user to the User Group"
}
else {
Add-LocalGroupMember -Group $group -Member $username
Write-Output "Adding user to the $group Group"
}
EXIT 0
}
catch {
Write-Output "An error has occured."
Write-Output $_
EXIT 1
}
EXIT $LASTEXITCODE