BatchPatch Forums Home › Forums › BatchPatch Support Forum › ps1 font install script not working
- This topic has 5 replies, 2 voices, and was last updated 2 years, 8 months ago by deepfriedbutter.
-
AuthorPosts
-
September 26, 2017 at 12:15 am #8941deepfriedbutterParticipant
I can run this script locally on the box and it works fine, but it does not work when I run it through batchpatch. It does not work through deployment, remote command or remote command logged. It just exits with code 0 and that’s it, so it appears to work, but it does not. Please help!
Thanks in advance
$FONTS = 0x14
# Set path to the fonts dir
$FromPath="\nasserverDocumentsbatchpatchfonts_2017"
$objShell = New-Object -ComObject Shell.Application
$objFolder = $objShell.Namespace($FONTS)
$CopyOptions = 4 + 16
$CopyFlag = [String]::Format("{0:x}", $CopyOptions)
#loop through each directory in the specified path looking for files with extensions starting with .tt or .o
foreach($File in $(Get-ChildItem -Path $FromPath -Include *.ttf,*.otf,*.fon,*.fnt -Recurse)) {
If (test-path "c:windowsfonts$($File.name)")
# {"$File already exists - not copying"} #Useful for testing
{}
Else
{
$CopyFlag = [String]::Format("{0:x}", $CopyOptions)
# "copying $($file.fullname)" # Useful for debugging
#installs fonts found in above loop to the Fonts directory
$objFolder.CopyHere($File.fullname, $CopyOptions)
New-ItemProperty -Name $File.fullname -Path "HKLM:SoftwareMicrosoftWindows NTCurrentVersionFonts" -PropertyType string -Value $File
}
}September 26, 2017 at 12:47 am #10400dougModeratorI would suggest a few things to try:
1. Change the ‘remote execution context’ to ‘Elevated token’ and then try again and see if it works.
BatchPatch Remote Execution Context
2. Change the \nasserver path in the script to a local/relative path instead of one that reaches out to a remote server. If your script is made to *not* access a remote path and instead is made to access the files locally (locally on the target computer), I suspect it will work.
Deploying a Script with Relative Instead of Absolute Paths
3. Follow the tutorial linked below that explains another way to deploy fonts:
Remotely Install OpenType (.otf) or TrueType (.ttf) Fonts
Please report back and let us know what you try and what works for you.
Thanks,
Doug
September 26, 2017 at 3:56 am #10401deepfriedbutterParticipant1. I’ve tried this and it does not help – the script doesn’t seem to run at all. no fonts are copied.
2. Will try.
3. The problem with this method is I have 100 servers and 88 fonts. I started with this method but it doesn’t scale well.
Thanks so much for your help!
September 26, 2017 at 3:43 pm #10402deepfriedbutterParticipant2. worked!
I did a file copy of the whole folder with the fonts then changed the path to the local path with the ps1 script inside the fonts folder. I believe this is a better method of installing fonts rather than creating a manual entry for each one.
consider me a happy camper!
thank you!!
September 26, 2017 at 3:51 pm #10403dougModeratorExcellent. Thanks for following up. I’m glad that 2 worked. I also understand that 3 does not scale well. I’ll ask the team to re-work the script so that it can be used for any number of fonts without having to fill in so much code.
-Doug
March 3, 2022 at 1:00 pm #13364deepfriedbutterParticipantHi Doug,
Do we have any updates here?
Thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.