From cb39181a0b50937f3bfe9def4662e45cff28e41d Mon Sep 17 00:00:00 2001 From: silversword411 Date: Thu, 18 Jul 2024 15:22:24 -0400 Subject: [PATCH] chore: Refactor add folder creation function --- scripts_staging/Win_Template.ps1 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts_staging/Win_Template.ps1 b/scripts_staging/Win_Template.ps1 index 49652b3c..ef966657 100644 --- a/scripts_staging/Win_Template.ps1 +++ b/scripts_staging/Win_Template.ps1 @@ -233,7 +233,7 @@ if (Test-IsAdmin) { function Test-IsInteractiveShell { # https://stackoverflow.com/questions/9738535/powershell-test-for-noninteractive-mode # Test each Arg for match of abbreviated '-NonInteractive' command. - $NonInteractive = [Environment]::GetCommandLineArgs() | Where-Object{ $_ -like '-NonI*' } + $NonInteractive = [Environment]::GetCommandLineArgs() | Where-Object { $_ -like '-NonI*' } if ([Environment]::UserInteractive -and -not$NonInteractive) { # We are in an interactive shell. @@ -298,3 +298,18 @@ If ("SetRegistryValue" -Match "true") { # Set-RegistryValue -registryPath $RegistryPath -name "PersonalizationReportingEnabled" -value 0 #Set-RegistryValue } + +<# ================================================================================ #> +Function Foldercreate { + param ( + [Parameter(Mandatory = $false)] + [String[]]$Paths + ) + + foreach ($Path in $Paths) { + if (!(Test-Path $Path)) { + New-Item -ItemType Directory -Force -Path $Path + } + } +} +Foldercreate -Paths "$env:ProgramData\TacticalRMM\temp", "C:\Temp" \ No newline at end of file