Skip to content

Commit 553e393

Browse files
Update powershell script
1 parent 77554f6 commit 553e393

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

canarytokens/windows_fake_fs_templates/powershell_template.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
}
4242
4343
try {
44-
Enable-WindowsOptionalFeature -Online -FeatureName "Client-ProjFS" -NoRestart
44+
Enable-WindowsOptionalFeature -Online -FeatureName "Client-ProjFS" -NoRestart | Out-Null
4545
Write-Host "Successfully enabled Projected File System." -ForegroundColor Green
4646
return
4747
}
@@ -54,17 +54,17 @@
5454
function New-ScheduledTask {
5555
Write-Host "Creating Windows Fake File System Token scheduled task..." -ForegroundColor Yellow
5656
57-
$scriptsDir = "$env:USERPROFILE\Scripts"
58-
if (-not (Test-Path $scriptsDir)) {
59-
New-Item -ItemType Directory -Path $scriptsDir
60-
}
61-
6257
if ((Test-Path -Path $RootPath -PathType Container) -and
6358
($null -ne (Get-ChildItem -Path $RootPath -Force))) {
6459
Write-Host "Warning: Target folder '$RootPath' is not empty. Deployment cancelled." -ForegroundColor Red
6560
exit
6661
}
6762
63+
$scriptsDir = "$env:USERPROFILE\Scripts"
64+
if (-not (Test-Path $scriptsDir)) {
65+
New-Item -ItemType Directory -Path $scriptsDir | Out-Null
66+
}
67+
6868
try {
6969
$processScript = @'
7070
function Invoke-WindowsFakeFileSystem {
@@ -841,7 +841,7 @@ class FileEntry
841841
$xmlPath = "$env:TEMP\task.xml"
842842
$taskXml | Out-File -FilePath $xmlPath -Encoding Unicode
843843
844-
schtasks /create /tn $TaskName /xml $xmlPath /f
844+
schtasks /create /tn $TaskName /xml $xmlPath /f | Out-Null
845845
846846
if ($LastExitCode -eq 0) {
847847
Write-Host "Successfully deployed Windows Fake File System Token" -ForegroundColor Green
@@ -921,7 +921,7 @@ class FileEntry
921921
}
922922
923923
Invoke-Step "Removing Projected File System feature" {
924-
Disable-WindowsOptionalFeature -Online -FeatureName "Client-ProjFS" -NoRestart
924+
Disable-WindowsOptionalFeature -Online -FeatureName "Client-ProjFS" -NoRestart | Out-Null
925925
}
926926
927927
Invoke-Step "Removing folder" {

0 commit comments

Comments
 (0)