Update cmd.txt
Browse files
cmd.txt
CHANGED
|
@@ -1,10 +1,18 @@
|
|
| 1 |
Write-Host "`n--- 1) Kiểm tra hosts file (tìm 'kms') ---" -ForegroundColor Cyan
|
| 2 |
$hosts = Get-Content -Path "$env:SystemRoot\System32\drivers\etc\hosts" -ErrorAction SilentlyContinue
|
| 3 |
-
if ($hosts -match 'kms') {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
Write-Host "`n--- 2) Kiểm tra scheduled tasks có chứa 'activate|aio|office|kms' ---" -ForegroundColor Cyan
|
| 6 |
$tasks = Get-ScheduledTask | Where-Object { $_.TaskName -match 'activate|aio|office|kms' -or $_.TaskPath -match 'activate|aio|office|kms' }
|
| 7 |
-
if ($tasks) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
Write-Host "`n--- 3) Kiểm tra service sppsvc (Software Protection) ---" -ForegroundColor Cyan
|
| 10 |
Get-Service -Name sppsvc -ErrorAction SilentlyContinue | Format-List Name, Status, StartType
|
|
@@ -19,28 +27,30 @@ $pathsToCheck = @(
|
|
| 19 |
"HKLM:\SOFTWARE\WOW6432Node",
|
| 20 |
"HKLM:\SYSTEM\CurrentControlSet\Services"
|
| 21 |
)
|
|
|
|
| 22 |
foreach ($p in $pathsToCheck) {
|
| 23 |
try {
|
| 24 |
-
Get-ChildItem -Path $p -Recurse -ErrorAction SilentlyContinue |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
Write-Output "Found in Registry Path:`$($_.PSPath)` Property:`$($prop.Name)` Value:`$val`"
|
| 32 |
-
}
|
| 33 |
}
|
| 34 |
}
|
| 35 |
}
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
| 37 |
}
|
|
|
|
| 38 |
Write-Host "`n--- 6) Kiểm tra trạng thái Office (nếu có OSPP.VBS) ---" -ForegroundColor Cyan
|
| 39 |
-
# Tìm OSPP.VBS trong Program Files chung và nếu có, in hướng dẫn kiểm tra /dstatus
|
| 40 |
$ospp = Get-ChildItem -Path "C:\Program Files","C:\Program Files (x86)" -Filter OSPP.VBS -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
|
| 41 |
if ($ospp) {
|
| 42 |
Write-Host "Found OSPP.VBS at: $($ospp.FullName)"
|
| 43 |
-
Write-Host "
|
| 44 |
} else {
|
| 45 |
Write-Host "No OSPP.VBS found in Program Files (official location)."
|
| 46 |
}
|
|
|
|
| 1 |
Write-Host "`n--- 1) Kiểm tra hosts file (tìm 'kms') ---" -ForegroundColor Cyan
|
| 2 |
$hosts = Get-Content -Path "$env:SystemRoot\System32\drivers\etc\hosts" -ErrorAction SilentlyContinue
|
| 3 |
+
if ($hosts -match 'kms') {
|
| 4 |
+
$hosts | Select-String -Pattern 'kms'
|
| 5 |
+
} else {
|
| 6 |
+
Write-Host "No kms entries in hosts file."
|
| 7 |
+
}
|
| 8 |
|
| 9 |
Write-Host "`n--- 2) Kiểm tra scheduled tasks có chứa 'activate|aio|office|kms' ---" -ForegroundColor Cyan
|
| 10 |
$tasks = Get-ScheduledTask | Where-Object { $_.TaskName -match 'activate|aio|office|kms' -or $_.TaskPath -match 'activate|aio|office|kms' }
|
| 11 |
+
if ($tasks) {
|
| 12 |
+
$tasks | Format-Table TaskName, @{n='Path';e={$_.TaskPath}}, State -AutoSize
|
| 13 |
+
} else {
|
| 14 |
+
Write-Host "No suspicious scheduled tasks found."
|
| 15 |
+
}
|
| 16 |
|
| 17 |
Write-Host "`n--- 3) Kiểm tra service sppsvc (Software Protection) ---" -ForegroundColor Cyan
|
| 18 |
Get-Service -Name sppsvc -ErrorAction SilentlyContinue | Format-List Name, Status, StartType
|
|
|
|
| 27 |
"HKLM:\SOFTWARE\WOW6432Node",
|
| 28 |
"HKLM:\SYSTEM\CurrentControlSet\Services"
|
| 29 |
)
|
| 30 |
+
|
| 31 |
foreach ($p in $pathsToCheck) {
|
| 32 |
try {
|
| 33 |
+
Get-ChildItem -Path $p -Recurse -ErrorAction SilentlyContinue | ForEach-Object {
|
| 34 |
+
$props = Get-ItemProperty -Path $_.PSPath -ErrorAction SilentlyContinue
|
| 35 |
+
if ($props) {
|
| 36 |
+
foreach ($prop in $props.PSObject.Properties) {
|
| 37 |
+
$val = $prop.Value
|
| 38 |
+
if ($val -and ($val -is [string]) -and ($val -match 'kms|kms\.srv|crsoo')) {
|
| 39 |
+
Write-Output "Found in Registry Path: $($_.PSPath) | Property: $($prop.Name) | Value: $val"
|
|
|
|
|
|
|
| 40 |
}
|
| 41 |
}
|
| 42 |
}
|
| 43 |
+
}
|
| 44 |
+
} catch {
|
| 45 |
+
# ignore permission errors
|
| 46 |
+
}
|
| 47 |
}
|
| 48 |
+
|
| 49 |
Write-Host "`n--- 6) Kiểm tra trạng thái Office (nếu có OSPP.VBS) ---" -ForegroundColor Cyan
|
|
|
|
| 50 |
$ospp = Get-ChildItem -Path "C:\Program Files","C:\Program Files (x86)" -Filter OSPP.VBS -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
|
| 51 |
if ($ospp) {
|
| 52 |
Write-Host "Found OSPP.VBS at: $($ospp.FullName)"
|
| 53 |
+
Write-Host "Nếu muốn kiểm tra trạng thái: cd tới thư mục đó rồi chạy `cscript OSPP.VBS /dstatus`"
|
| 54 |
} else {
|
| 55 |
Write-Host "No OSPP.VBS found in Program Files (official location)."
|
| 56 |
}
|