Additional Script Updates
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
# Check if a specific file exists
|
||||
$filePath = "C:\Company\Compliance\requiredfile.txt"
|
||||
|
||||
if (Test-Path $filePath) {
|
||||
Write-Output "Compliance file is present."
|
||||
} else {
|
||||
Write-Output "Compliance file is missing."
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
# 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
|
||||
}
|
||||
Reference in New Issue
Block a user