hello i have a config file with end like this on many server so i need to add # in the begin of the line
"C:\Documents and Settings\All Users\Application Data\McAfee\DesktopProtection\UpdateLog.txt" 8h warning * 0800 1800
"C:\EURNTCC\mcafee\sucessfull-update.log.txt" 8h warning * 0800 1800
i made a little script like this
$file="\\server\C$\osit\etc\act_mon.cfg"
$text1='"C:\DOCUMENTS AND SETTINGS\ALL USERS\APPLICATION DATA\MCAFEE\DESKTOPPROTECTION\UPDATELOG.TXT"'
$text2='"C:\EURNTCC\MCAFEE\SUCESSFULL-UPDATE.LOG.TXT"'
(gc $file) -replace $text2 ,("#" + $text1) |Set-Content $file
(gc $file) -replace $text2 ,("#" + $text2) |Set-Content $file
i have this error any help to understand this error , i have 650 server to update
The regular expression pattern "C:\EURNTCC\MCAFEE\SUCESSFULL-UPDATE.LOG.TXT" is not valid. At line:1 char:1
- (gc $file) -replace $text1 ,("#" + $text1) |Set-Content $file
-
+ CategoryInfo : InvalidOperation: ("C:\EURNTCC\MCA...UPDATE.LOG.TXT":String) [], RuntimeException + FullyQualifiedErrorId : InvalidRegularExpression