I have an issue with a Firefox module. To resolve the issue I need to append text to a text file that is found under each user's firefox profile.
I can copy the new text file to each users profile using the below powershell script:
# Check to see if AWP is actually installed
$chkAWPExists = "C:\Program Files\Middleware Directory\Middleware"
$aWPExists = Test-Path $chkAWPExists
# If AWP Exists copy the pkcs11.txt file to all Firefox Profiles found.
If ($aWPExists -eq $True) {
Write-Log "AWP Exists. Copying pkcs11.txt to all firefox profiles"
Get-ChildItem -Path 'C:\Users\*\AppData\Roaming\Mozilla\Firefox\Profiles\*\pkcs11.txt' |
ForEach-Object {
Copy-Item -Path 'pkcs11.txt' -Destination $_.DirectoryName
}
}
else {
Write-Log "AWP doesn't seem to be installed. Please install Oberthur Authentic web pack before activating this module."
ExitCode 1
}
But my issue is that each text file seems to have a unique info to each user. It may make sense to just append the new text lines on the end of the txt file.
Can anyone help me figure out how to append text to each users profile and loop through them all?
This is an example of two lines of text i need to add:
library=etpkcs11.dll
name=eToken PKCS#11 Module
Any help would be appreciated.
I also can't think of how im going to resolve new profiles once i run the script. But that's a battle for another day.