Merge pull request #345 from silversword411/develop

Updating scripts
This commit is contained in:
Dan
2021-03-29 14:12:00 -07:00
committed by GitHub
4 changed files with 133 additions and 103 deletions

View File

@@ -77,11 +77,12 @@
"shell": "powershell"
},
{
"filename": "bitlocker_create_status_report.ps1",
"filename": "Win_Bitlocker_Create_Status_Report.ps1",
"submittedBy": "https://github.com/ThatsNASt",
"name": "Create Bitlocker Status Report",
"description": "Creates a Bitlocker status report.",
"shell": "powershell"
"shell": "powershell",
"category": "TRMM (Win):Storage"
},
{
"filename": "bitlocker_retrieve_status_report.ps1",
@@ -225,24 +226,35 @@
"shell": "cmd"
},
{
"filename": "AD_Check_And_Enable_AD_Recycle_Bin.ps1",
"filename": "Win_AD_Check_And_Enable_AD_Recycle_Bin.ps1",
"submittedBy": "https://github.com/silversword411",
"name": "AD - Check and Enable AD Recycle Bin",
"description": "Only run on Domain Controllers, checks for Active Directory Recycle Bin and enables if not already enabled",
"shell": "powershell"
"shell": "powershell",
"category": "TRMM (Win):Active Directory"
},
{
"filename": "Check_Events_for_Bluescreens.ps1",
"submittedBy": "https://github.com/dinger1986",
"name": "Event Viewer - Check for Bluescreens",
"description": "This will check for Bluescreen events on your system",
"shell": "powershell"
"shell": "powershell",
"category": "TRMM (Win):Monitoring"
},
{
"filename": "Rename_Computer.ps1",
"submittedBy": "https://github.com/silversword411",
"name": "Rename Computer",
"description": "Rename computer. First parameter will be new PC name. 2nd parameter if yes will auto-reboot machine",
"shell": "powershell"
"shell": "powershell",
"category": "TRMM (Win):Other"
},
{
"filename": "Win_MS_Install_All_Updates.ps1",
"submittedBy": "https://github.com/dinger1986",
"name": "Install all Updates",
"description": "Install All updating for Windows 10 using powershell",
"shell": "powershell",
"category": "TRMM (Win):Updates"
}
]
]

View File

@@ -1,97 +1,97 @@
## Copied from https://github.com/ThatsNASt/tacticalrmm to add to new pull request for https://github.com/wh1te909/tacticalrmm
function Log-Message {
Param
(
[Parameter(Mandatory = $true, Position = 0)]
[string]$LogMessage,
[Parameter(Mandatory = $false, Position = 1)]
[string]$LogFile,
[Parameter(Mandatory = $false, Position = 2)]
$Echo
)
if ($LogFile) {
Write-Output ("{0} - {1}" -f (Get-Date), $LogMessage) | Out-File -Append $LogFile
if ($Echo) {
Write-Output ("{0} - {1}" -f (Get-Date), $LogMessage)
}
}
Else {
Write-Output ("{0} - {1}" -f (Get-Date), $LogMessage)
}
}
$log = "BitlockerReport.txt"
#Find BL info
$mbde = [string](manage-bde -status)
$mbdeProt = (manage-bde -protectors -get c: | Select-Object -Skip 6)
#Dig out the recovery password, check for PIN
ForEach ($line in $mbdeProt) {
if ($line -like "******-******-******-******-******-******-******-******") {
$RecoveryPassword = $line.Trim()
}
if ($line -like "*TPM And PIN:*") {
$PIN = $true
}
}
#Determine BL status
if ($mbde.Contains("Fully Decrypted")) {
$Encrypted = "No"
}
if ($mbde.Contains("Fully Encrypted")) {
$Encrypted = "Yes"
}
if ($mbde.Contains("Encryption in Progress")) {
$Encrypted = "InProgress"
}
if ($mbde.Contains("Decryption in Progress")) {
$Encrypted = "InProgressNo"
}
#Check for recovery password, report if found.
if ($RecoveryPassword) {
Try {
Log-Message "RP: $RecoveryPassword" $log e -ErrorAction Stop
}
#Catch for recovery password in place but encryption not active
Catch {
Log-Message "Could not retrieve recovery password, but it is enabled." $log e
}
}
if (!$RecoveryPassword) {
Log-Message "No Recovery Password found." $log e
}
#Try to make a summary for common situations
if ($Encrypted -eq "No" -and !$RecoveryPassword) {
Log-Message "WARNING: Decrypted, no password." $log e
exit 2001
}
if ($Encrypted -eq "No" -and $RecoveryPassword) {
Log-Message "WARNING: Decrypted, password set. Interrupted process?" $log e
exit 2002
}
if ($Encrypted -eq "Yes" -and !$RecoveryPassword) {
Log-Message "WARNING: Encrypted, no password." $log e
exit 2000
}
if ($Encrypted -eq "InProgress" -and $RecoveryPassword) {
Log-Message "WARNING: Encryption in progress, password set." $log e
exit 3000
}
if ($Encrypted -eq "InProgress" -and !$RecoveryPassword) {
Log-Message "WARNING: Encryption in progress, no password." $log e
exit 3001
}
if ($Encrypted -eq "InProgressNo") {
Log-Message "WARNING: Decryption in progress" $log e
exit 3002
}
if ($Encrypted -eq "Yes" -and $RecoveryPassword -and !$PIN) {
Log-Message "WARNING: Encrypted, PIN DISABLED, password is set." $log e
exit 3003
}
if ($Encrypted -eq "Yes" -and $RecoveryPassword -and $PIN -eq $true) {
Log-Message "SUCCESS: Encrypted, PIN enabled, password is set." $log e
Write-Host "Script check passed"
exit 0
## Copied from https://github.com/ThatsNASt/tacticalrmm to add to new pull request for https://github.com/wh1te909/tacticalrmm
function Log-Message {
Param
(
[Parameter(Mandatory = $true, Position = 0)]
[string]$LogMessage,
[Parameter(Mandatory = $false, Position = 1)]
[string]$LogFile,
[Parameter(Mandatory = $false, Position = 2)]
$Echo
)
if ($LogFile) {
Write-Output ("{0} - {1}" -f (Get-Date), $LogMessage) | Out-File -Append $LogFile
if ($Echo) {
Write-Output ("{0} - {1}" -f (Get-Date), $LogMessage)
}
}
Else {
Write-Output ("{0} - {1}" -f (Get-Date), $LogMessage)
}
}
$log = "BitlockerReport.txt"
#Find BL info
$mbde = [string](manage-bde -status)
$mbdeProt = (manage-bde -protectors -get c: | Select-Object -Skip 6)
#Dig out the recovery password, check for PIN
ForEach ($line in $mbdeProt) {
if ($line -like "******-******-******-******-******-******-******-******") {
$RecoveryPassword = $line.Trim()
}
if ($line -like "*TPM And PIN:*") {
$PIN = $true
}
}
#Determine BL status
if ($mbde.Contains("Fully Decrypted")) {
$Encrypted = "No"
}
if ($mbde.Contains("Fully Encrypted")) {
$Encrypted = "Yes"
}
if ($mbde.Contains("Encryption in Progress")) {
$Encrypted = "InProgress"
}
if ($mbde.Contains("Decryption in Progress")) {
$Encrypted = "InProgressNo"
}
#Check for recovery password, report if found.
if ($RecoveryPassword) {
Try {
Log-Message "RP: $RecoveryPassword" $log e -ErrorAction Stop
}
#Catch for recovery password in place but encryption not active
Catch {
Log-Message "Could not retrieve recovery password, but it is enabled." $log e
}
}
if (!$RecoveryPassword) {
Log-Message "No Recovery Password found." $log e
}
#Try to make a summary for common situations
if ($Encrypted -eq "No" -and !$RecoveryPassword) {
Log-Message "WARNING: Decrypted, no password." $log e
exit 2001
}
if ($Encrypted -eq "No" -and $RecoveryPassword) {
Log-Message "WARNING: Decrypted, password set. Interrupted process?" $log e
exit 2002
}
if ($Encrypted -eq "Yes" -and !$RecoveryPassword) {
Log-Message "WARNING: Encrypted, no password." $log e
exit 2000
}
if ($Encrypted -eq "InProgress" -and $RecoveryPassword) {
Log-Message "WARNING: Encryption in progress, password set." $log e
exit 3000
}
if ($Encrypted -eq "InProgress" -and !$RecoveryPassword) {
Log-Message "WARNING: Encryption in progress, no password." $log e
exit 3001
}
if ($Encrypted -eq "InProgressNo") {
Log-Message "WARNING: Decryption in progress" $log e
exit 3002
}
if ($Encrypted -eq "Yes" -and $RecoveryPassword -and !$PIN) {
Log-Message "WARNING: Encrypted, PIN DISABLED, password is set." $log e
exit 3003
}
if ($Encrypted -eq "Yes" -and $RecoveryPassword -and $PIN -eq $true) {
Log-Message "SUCCESS: Encrypted, PIN enabled, password is set." $log e
Write-Host "Script check passed"
exit 0
}

View File

@@ -0,0 +1,18 @@
$ErrorActionPreference = 'silentlycontinue'
if (Get-Module -ListAvailable -Name NuGet) {
Write-Host "NuGet exists"
}
else {
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
}
if (Get-Module -ListAvailable -Name PSWindowsUpdate) {
Write-Host "PSWindowsUpdate exists"
}
else {
Install-Module -Name PSWindowsUpdate -force
}
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
Get-WindowsUpdate -install -acceptall