Skip to content

Commit

Permalink
chore: Refactor add folder creation function
Browse files Browse the repository at this point in the history
  • Loading branch information
silversword411 committed Jul 18, 2024
1 parent f287fbd commit cb39181
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts_staging/Win_Template.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"

0 comments on commit cb39181

Please sign in to comment.