Adding scripts

This commit is contained in:
silversword411 2021-07-17 10:33:31 -04:00
parent 023ff3f964
commit b60a3a5e50
No known key found for this signature in database
GPG Key ID: 6F4BD176F56B50CA
3 changed files with 60 additions and 0 deletions

View File

@ -619,6 +619,16 @@
"category": "TRMM (Win):Other",
"default_timeout": "90"
},
{
"guid": "43e65e5f-717a-4b6d-a724-1a86229fcd42",
"filename": "Win_Network_Hosts_AddRemove.ps1",
"submittedBy": "https://github.com/dinger1986",
"name": "Windows Activation check",
"description": "Checks to see if windows is activated and returns status",
"shell": "powershell",
"category": "TRMM (Win):Other",
"default_timeout": "120"
},
{
"guid": "83f6c6ea-6120-4fd3-bec8-d3abc505dcdf",
"filename": "Win_TRMM_Start_Menu_Delete_Shortcut.ps1",

View File

@ -0,0 +1,13 @@
$WinVerAct = (cscript /Nologo "C:\Windows\System32\slmgr.vbs" /xpr) -join ''
if ($WinVerAct -like '*Activated*') {
Write-Output "All looks fine $WinVerAct"
exit 0
}
else {
Write-Output "Theres an issue $WinVerAct"
exit 1
}
Exit $LASTEXITCODE

View File

@ -0,0 +1,37 @@
# For TRMM need to be able to handle all 3 TRMM url's at once. Add these command parameters. Should probably include with howto doc that will use Key Store default recommended keys eg
# rmmurl would be {{global.rmmurl}}
# meshurl would be {{global.meshurl}}
# apiurl would be {{global.apiurl}}
# rmmip would be {{global.rmmip}}
# -allip (does all) 3 URL's with same IP
# -rmmurl
# -meshurl
# -apiurl
# -rmmip
# -meship
# -apiip
# By Tom Chantler - https://tomssl.com/2019/04/30/a-better-way-to-add-and-remove-windows-hosts-file-entries/
param([bool]$CheckHostnameOnly = $false)
$DesiredIP = $IP
$Hostname = $URL
# Adds entry to the hosts file.
#Requires -RunAsAdministrator
$hostsFilePath = "$($Env:WinDir)\system32\Drivers\etc\hosts"
$hostsFile = Get-Content $hostsFilePath
Write-Host "About to add $desiredIP for $Hostname to hosts file" -ForegroundColor Gray
$escapedHostname = [Regex]::Escape($Hostname)
$patternToMatch = If ($CheckHostnameOnly) { ".*\s+$escapedHostname.*" } Else { ".*$DesiredIP\s+$escapedHostname.*" }
If (($hostsFile) -match $patternToMatch) {
Write-Host $desiredIP.PadRight(20, " ") "$Hostname - not adding; already in hosts file" -ForegroundColor DarkYellow
}
Else {
Write-Host $desiredIP.PadRight(20, " ") "$Hostname - adding to hosts file... " -ForegroundColor Yellow -NoNewline
Add-Content -Encoding UTF8 $hostsFilePath ("$DesiredIP".PadRight(20, " ") + "$Hostname")
Write-Host " done"
}