15 lines
586 B
PowerShell
15 lines
586 B
PowerShell
# Ensure the specific file is in place
|
|
$filePath = "C:\Company\Compliance\requiredfile.txt"
|
|
$fileContent = "This is a required compliance file."
|
|
|
|
if (-Not (Test-Path $filePath)) {
|
|
# Create the directory if it doesn't exist
|
|
$directoryPath = [System.IO.Path]::GetDirectoryName($filePath)
|
|
if (-Not (Test-Path $directoryPath)) {
|
|
New-Item -Path $directoryPath -ItemType Directory -Force | Out-Null
|
|
}
|
|
# Create the file with the required content
|
|
New-Item -Path $filePath -ItemType File -Force | Out-Null
|
|
Set-Content -Path $filePath -Value $fileContent
|
|
}
|