Private/Hide-Folder.ps1
function Hide-Folder { param ( [string]$Destination, [string]$LogPath ) $folderPath = Join-Path -Path $Destination -ChildPath "AppData" if (Test-Path -Path $folderPath) { try { # Set the hidden attribute on the folder Set-ItemProperty -Path $folderPath -Name Attributes -Value ([System.IO.FileAttributes]::Hidden) Write-Log -Message "Successfully set the hidden attribute on $folderPath" -LogPath $LogPath } catch { Write-Log -Message "Failed to set the hidden attribute on $folderPath. Error: $_" -LogPath $LogPath } } else { Write-Log -Message "The path $folderPath does not exist." -LogPath $LogPath } } |