Intune Initial Scripts Backup
This commit is contained in:
4
intune/Proactive Remediations/TNS_ADMIN/Install.bat
Normal file
4
intune/Proactive Remediations/TNS_ADMIN/Install.bat
Normal file
@@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
pushd %~dp0
|
||||
powershell.exe -ExecutionPolicy Bypass -File "TNS_ADMIN-Detection.ps1"
|
||||
popd
|
||||
@@ -0,0 +1,30 @@
|
||||
# Discovery
|
||||
|
||||
# path to the directory that TNS_ADMIN should point towards
|
||||
# Make sure its the same in both the remediation and discovery scripts
|
||||
$value = "\\ccx.carecentrix.com\public\oracle"
|
||||
|
||||
try {
|
||||
|
||||
# create the TNS_ADMIN directory if it doesn't exist, no need to use a remediation to do that
|
||||
if ( (Test-Path -Path $value -ErrorAction stop) -eq $false ) {
|
||||
Write-Host "$value directory missing"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# check the TNS_ADMIN environmental variable
|
||||
$TNS_ADMINVar = [System.Environment]::GetEnvironmentVariable('TNS_ADMIN', 'Machine')
|
||||
if ($TNS_ADMINVar -ne $value) {
|
||||
Write-Host "failure, TNS_ADMIN is set to $TNS_ADMINVar"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "TNS_ADMIN Variables set correctly"
|
||||
exit 0
|
||||
|
||||
}
|
||||
catch {
|
||||
$errMsg = $_.Exception.Message
|
||||
Write-Host $errMsg
|
||||
exit 1
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
# Remediation
|
||||
|
||||
# path to the directory that TNS_ADMIN should point towards
|
||||
# Make sure its the same in both the remediation and discovery scripts
|
||||
$value = "\\ccx.carecentrix.com\public\oracle"
|
||||
|
||||
try {
|
||||
|
||||
# create the TNS_ADMIN directory if it doesn't exist
|
||||
if ( (Test-Path -Path $value) -eq $false ) {
|
||||
New-Item -Path $value -ItemType Directory
|
||||
}
|
||||
|
||||
# set the variables
|
||||
[System.Environment]::SetEnvironmentVariable('TNS_ADMIN','\\ccx.carecentrix.com\public\oracle','Machine')
|
||||
|
||||
Write-Host "TNS_ADMIN Machine variables Changed"
|
||||
exit 0
|
||||
}
|
||||
catch {
|
||||
$errMsg = $_.Exception.Message
|
||||
Write-Host $errMsg
|
||||
exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user