feat(RDPSign): opdatér Get-DesktopPaths til OneDrive Desktop
- Erstat Join-Path/Test-Path med Get-ChildItem -Filter "Desktop" -Depth 2
så OneDrive-omdirigeret Desktop også fanges
- Tilføj -Exclude "Public","Default" for at springe systemprofiler over
- Anvendt i app/Install.ps1, Detect.ps1, Uninstall.ps1, SignOnly.ps1,
SignOnly_detect.ps1, Clearsigning.ps1, sandbox.ps1
This commit is contained in:
@@ -13,15 +13,14 @@ param(
|
|||||||
|
|
||||||
function Get-DesktopPaths {
|
function Get-DesktopPaths {
|
||||||
if ($AllUsers) {
|
if ($AllUsers) {
|
||||||
Get-ChildItem "$env:SystemDrive\Users" -Directory | ForEach-Object {
|
Get-ChildItem "$env:SystemDrive\Users" -Directory -Exclude "Public","Default" | ForEach-Object {
|
||||||
$path = Join-Path $_.FullName "Desktop"
|
Get-ChildItem $_.FullName -Directory -Filter "Desktop" -Depth 2 -ErrorAction SilentlyContinue |
|
||||||
if (Test-Path $path) { $path }
|
Select-Object -ExpandProperty FullName
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$certSubject = "CN=RDPSign"
|
$certSubject = "CN=RDPSign"
|
||||||
|
|
||||||
# 1. Unsign RDP files
|
# 1. Unsign RDP files
|
||||||
|
|||||||
+3
-3
@@ -39,9 +39,9 @@ function Write-Log {
|
|||||||
|
|
||||||
function Get-DesktopPaths {
|
function Get-DesktopPaths {
|
||||||
if ($AllUsers) {
|
if ($AllUsers) {
|
||||||
Get-ChildItem "$env:SystemDrive\Users" -Directory | ForEach-Object {
|
Get-ChildItem "$env:SystemDrive\Users" -Directory -Exclude "Public","Default" | ForEach-Object {
|
||||||
$path = Join-Path $_.FullName "Desktop"
|
Get-ChildItem $_.FullName -Directory -Filter "Desktop" -Depth 2 -ErrorAction SilentlyContinue |
|
||||||
if (Test-Path $path) { $path }
|
Select-Object -ExpandProperty FullName
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
||||||
|
|||||||
+3
-5
@@ -34,16 +34,14 @@ function Write-Log {
|
|||||||
|
|
||||||
function Get-DesktopPaths {
|
function Get-DesktopPaths {
|
||||||
if ($AllUsers) {
|
if ($AllUsers) {
|
||||||
# Return desktop path for each user profile found
|
Get-ChildItem "$env:SystemDrive\Users" -Directory -Exclude "Public","Default" | ForEach-Object {
|
||||||
Get-ChildItem "$env:SystemDrive\Users" -Directory | ForEach-Object {
|
Get-ChildItem $_.FullName -Directory -Filter "Desktop" -Depth 2 -ErrorAction SilentlyContinue |
|
||||||
$path = Join-Path $_.FullName "Desktop"
|
Select-Object -ExpandProperty FullName
|
||||||
if (Test-Path $path) { $path }
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$desktopPaths = Get-DesktopPaths
|
$desktopPaths = Get-DesktopPaths
|
||||||
Write-Log "Running in mode: $(if ($AllUsers) { 'All Users' } else { 'Public Desktop' })"
|
Write-Log "Running in mode: $(if ($AllUsers) { 'All Users' } else { 'Public Desktop' })"
|
||||||
|
|||||||
+3
-4
@@ -34,15 +34,14 @@ function Write-Log {
|
|||||||
|
|
||||||
function Get-DesktopPaths {
|
function Get-DesktopPaths {
|
||||||
if ($AllUsers) {
|
if ($AllUsers) {
|
||||||
Get-ChildItem "$env:SystemDrive\Users" -Directory | ForEach-Object {
|
Get-ChildItem "$env:SystemDrive\Users" -Directory -Exclude "Public","Default" | ForEach-Object {
|
||||||
$path = Join-Path $_.FullName "Desktop"
|
Get-ChildItem $_.FullName -Directory -Filter "Desktop" -Depth 2 -ErrorAction SilentlyContinue |
|
||||||
if (Test-Path $path) { $path }
|
Select-Object -ExpandProperty FullName
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$certSubjectName = "RDPSign"
|
$certSubjectName = "RDPSign"
|
||||||
$certSubject = "CN=$certSubjectName"
|
$certSubject = "CN=$certSubjectName"
|
||||||
|
|||||||
@@ -13,15 +13,14 @@ param(
|
|||||||
|
|
||||||
function Get-DesktopPaths {
|
function Get-DesktopPaths {
|
||||||
if ($AllUsers) {
|
if ($AllUsers) {
|
||||||
Get-ChildItem "$env:SystemDrive\Users" -Directory | ForEach-Object {
|
Get-ChildItem "$env:SystemDrive\Users" -Directory -Exclude "Public","Default" | ForEach-Object {
|
||||||
$path = Join-Path $_.FullName "Desktop"
|
Get-ChildItem $_.FullName -Directory -Filter "Desktop" -Depth 2 -ErrorAction SilentlyContinue |
|
||||||
if (Test-Path $path) { $path }
|
Select-Object -ExpandProperty FullName
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$certSubject = "CN=RDPSign"
|
$certSubject = "CN=RDPSign"
|
||||||
|
|
||||||
# Check certificate exists in all three stores
|
# Check certificate exists in all three stores
|
||||||
|
|||||||
+3
-4
@@ -27,15 +27,14 @@ function Write-Log {
|
|||||||
|
|
||||||
function Get-DesktopPaths {
|
function Get-DesktopPaths {
|
||||||
if ($AllUsers) {
|
if ($AllUsers) {
|
||||||
Get-ChildItem "$env:SystemDrive\Users" -Directory | ForEach-Object {
|
Get-ChildItem "$env:SystemDrive\Users" -Directory -Exclude "Public","Default" | ForEach-Object {
|
||||||
$path = Join-Path $_.FullName "Desktop"
|
Get-ChildItem $_.FullName -Directory -Filter "Desktop" -Depth 2 -ErrorAction SilentlyContinue |
|
||||||
if (Test-Path $path) { $path }
|
Select-Object -ExpandProperty FullName
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$desktopPaths = Get-DesktopPaths
|
$desktopPaths = Get-DesktopPaths
|
||||||
Write-Log "Running in mode: $(if ($AllUsers) { 'All Users' } else { 'Public Desktop' })"
|
Write-Log "Running in mode: $(if ($AllUsers) { 'All Users' } else { 'Public Desktop' })"
|
||||||
|
|||||||
+3
-4
@@ -36,15 +36,14 @@ function Write-Log {
|
|||||||
|
|
||||||
function Get-DesktopPaths {
|
function Get-DesktopPaths {
|
||||||
if ($AllUsers) {
|
if ($AllUsers) {
|
||||||
Get-ChildItem "$env:SystemDrive\Users" -Directory | ForEach-Object {
|
Get-ChildItem "$env:SystemDrive\Users" -Directory -Exclude "Public","Default" | ForEach-Object {
|
||||||
$path = Join-Path $_.FullName "Desktop"
|
Get-ChildItem $_.FullName -Directory -Filter "Desktop" -Depth 2 -ErrorAction SilentlyContinue |
|
||||||
if (Test-Path $path) { $path }
|
Select-Object -ExpandProperty FullName
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
[Environment]::GetFolderPath("CommonDesktopDirectory")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# INSTALL
|
# INSTALL
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user