ITMcmcpa
asked on
Script to replace Outlook Signature graphics
Hello,
I need a script that will look for a specific file in subfolders based on name and size and replace it with another file.
Here is the task:
We have to change a graphic on our Firm's Outlook signature block. I want to run a script on each computer (maybe via login script) that will search all signature folders and it's subfolders under %appdata%/Microsoft/Signat ures and replace the file image003.gif that has a size of 2470 bytes. We will replace it with another file called image003.gif copied from another network location.
Thanks!
I need a script that will look for a specific file in subfolders based on name and size and replace it with another file.
Here is the task:
We have to change a graphic on our Firm's Outlook signature block. I want to run a script on each computer (maybe via login script) that will search all signature folders and it's subfolders under %appdata%/Microsoft/Signat
Thanks!
You might need to copy the replacement file to the local drive to use the above script.
http://www.remotedatabackups.com/kb/kb.cfm?id=63
http://www.remotedatabackups.com/kb/kb.cfm?id=63
ASKER
Unfortunately this will not work for my needs.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This script will find a file on C drive (or whatever drive we choose), rename it and replace it with another file. The new file should be in the same directory where you execute your powershell script.
#Because of CIM_DataFile, split File Name and Extension into two variables
$strFileName = "Foo"
$strFileExt = "doc"
$strNewFileName = "Foo2.doc"
$colFiles = get-wmiobject -query "Select * from CIM_Datafile where FileName = '$strFileName'and extension = '$strFileExt' and drive ='C:'"
Foreach ($objfile in $colfiles)
{
Ren $objfile.name -newname ($objfile.filename +".bak")
copy-item $strNewFileName -destination ($objfile.drives + $objfile.path)
}