Hello there,
i wrote a script with PSAPPDEP to change the default XML file for Symantec EPP to our´s but this makes a problem.
if i run my script as local Admin it´s run fine and there comes no error and the file would be change.
if i run the script with SYSTEM Credential, also as CM12, the script runs into error and said the folder is locked.
here now the part of my script.
##*===============================================
##* INSTALLATION
##*===============================================
[string]$installPhase = 'Installation'
## Handle Zero-Config MSI Installations
If ($useDefaultMsi) { Execute-MSI -Action 'Install' -Path $defaultMsiFile }
## <Perform Installation tasks here>
$client = Get-childitem env:computername
#$strFileName = ${env:ProgramFiles(x86)} + '\Symantec\Symantec Endpoint Protection\Smc.exe'
#$strFileName1 = ${env:ProgramData} + '\Symantec\Symantec Endpoint Protection\CurrentVersion\Data\Config'
$REGKEYSYMANTEC0 = Get-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\services\SysPlant"
$REGKEYSYMANTEC1 = $REGKEYSYMANTEC0.ConfigDatDir + 'SyLink.xml'
Execute-Process -Path "CMD.EXE" -Parameters '/C start smc.exe -stop' -WindowStyle Hidden
Start-Sleep 10
If ($client -Match "NTB*") { Copy-File -Path "$dirFiles\GER_W7_ID-W7_Laptops_sylink.xml" -Destination "$REGKEYSYMANTEC1" -Recurse }
If ($client -Match "WKS*") { Copy-File -Path "$dirFiles\GER_W7_ID-W7_Desktops_sylink.xml" -Destination "$REGKEYSYMANTEC1" -Recurse }
If ($client -Match "WAE*") { Copy-File -Path "$dirFiles\GER_W7_ID-W7_Desktops_sylink.xml" -Destination "$REGKEYSYMANTEC1" -Recurse }
Start-Sleep 5
Execute-Process -Path "CMD.EXE" -Parameters '/C start smc.exe -start' -WindowStyle Hidden
Start-Sleep 10
and here is the error message from System.
[Installation] :: Failed to copy file(s) in path [C:\WINDOWS\ccmcache\45\Files\GER_W7_ID-W7_Laptops_sylink.xml] to destination [C:\ProgramData\Symantec\Symantec Endpoint Protection\12.1.5337.5000.105\Data\Config\SyLink.xml].
Error Record:
-------------
Message : Der Zugriff auf den Pfad "C:\ProgramData\Symantec\Symantec
Endpoint
Protection\12.1.5337.5000.105\Data\Config\SyLink.xml" wurde
verweigert.
InnerException :
FullyQualifiedErrorId : CopyFileInfoItemUnauthorizedAccessError,Microsoft.Power
Shell.Commands.CopyItemCommand
ScriptStackTrace : bei Copy-File<Process>, C:\WINDOWS\ccmcache\45\AppDeplo
yToolkit\AppDeployToolkitMain.ps1: Zeile 2838
bei <ScriptBlock>,
C:\WINDOWS\ccmcache\45\Deploy-Application.ps1: Zeile
135
bei <ScriptBlock>, <Keine Datei>: Zeile 1
bei <ScriptBlock>, <Keine Datei>: Zeile 1
PositionMessage : In C:\WINDOWS\ccmcache\45\AppDeployToolkit\AppDeployToolkitMa
in.ps1:2838 Zeichen:5
+ Copy-Item -Path $Path -Destination
$destination -Force -Recurse -ErrorAction ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if somebody has an idea, let it me know. i am now a little bit confused.
with best regards
andré