Know to Set File Association via Group Policy


Recently after installing FAX Server on our site, we are having some problem with opening received FAX file from user desktop. FAX files are .G3N/.G3F/.CTLof which .G3N and .G3F file can be opened in Windows Image Viewer and .CTLfile can be opened in Notepad.
But the problem is, users have to make it their own, or we have to do it manually on all workstation across all branches. But it’s almost impossible to do so, so we have to think about some global solution.

Now we start working on creation a Group policy with which we can easily define default file association for those files and finally we created one.
FileAssociation.ADM


12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
CLASS USERCATEGORY !!category CATEGORY "Default Viewer/Icon for G3N File" KEYNAME "Software\Classes\.g3n\DefaultIcon"  POLICY !!policyg3nicon   EXPLAIN !!explain   PART Default   EDITTEXT   DEFAULT "shimgvw.dll,1"   VALUENAME ""   END PART  END POLICY END CATEGORY  CATEGORY "Default Viewer/Icon for G3N File" KEYNAME "Software\Classes\.g3n\shell\Open\command"  POLICY !!policyg3nview   EXPLAIN !!explain   PART Default   EDITTEXT   DEFAULT "rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %1"   VALUENAME ""   END PART  END POLICY END CATEGORY  CATEGORY "Default Viewer/Icon for G3F File" KEYNAME "Software\Classes\.g3f\DefaultIcon"  POLICY !!policyg3ficon   EXPLAIN !!explain   PART Default   EDITTEXT   DEFAULT "shimgvw.dll,1"   VALUENAME ""   END PART  END POLICY END CATEGORY  CATEGORY "Default Viewer/Icon for G3F File" KEYNAME "Software\Classes\.g3f\shell\Open\command"  POLICY !!policyg3fview   EXPLAIN !!explain   PART Default   EDITTEXT   DEFAULT "rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %1"   VALUENAME ""   END PART  END POLICY END CATEGORY  CATEGORY "Default Viewer/Icon for CTL File" KEYNAME "Software\Classes\.ctl\DefaultIcon"  POLICY !!policyctlicon   EXPLAIN !!explain   PART Default   EDITTEXT   DEFAULT "C:\WINDOWS\system32\shell32.dll,-152"   VALUENAME ""   END PART  END POLICY END CATEGORY  CATEGORY "Default Viewer/Icon for CTL File" KEYNAME "Software\Classes\.ctl\shell\Open\command"  POLICY !!policyctlview   EXPLAIN !!explain   PART Default   EDITTEXT   DEFAULT "C:\WINDOWS\system32\NOTEPAD.EXE %1"   VALUENAME ""   END PART  END POLICY END CATEGORY END CATEGORY [strings]category="Zita FAX File Associations"policyg3nicon="Set Default Icon for G3N File"policyg3nview="Set default Viewer for G3N File"policyg3ficon="Set Default Icon for G3N File"policyg3fview="Set default Viewer for G3N File"policyctlicon="Set Default Icon for CTL File"policyctlview="Set default Viewer for CTL File"explain="This policy sets the default file association for G3N files and it's default icon. Custom Group Policy - TechnoChat.IN ! By Saugata Datta."
Group Policy Fig -1

Group Policy Fig -2

Automatic NT-Backup (System State Backup) with retention period and e-mail notification after complete.


A simple script for automatic System State backup where you can easily set backup retention period and it also send you an e-mail notification after completion. With this script you can also archive backup log and if you wish u can also set backup log retention period. It can also set backup files with date stamp.
For e.g., SysBackup_ComputerName_24-03-2009.bkf

You need two small utility,
  • Blat.exe for sending mail, you can get details from here.
  • Forfiles.exe for checking old files, you can get details from here.
Just download following zip file and extract its content to %windir%\ or%windir%\system32 folder.
Download:

Mail Notification





Following are the basic Backup Settings

::Backup Settings START
::Set Backup Path
::~~~~~~~~~~~~~~~~~~~~
set savepath=D:\TestBackup
::Set Backup Name
::~~~~~~~~~~~~~~~~~~~~
set backupname=SysBackup
::Set Backup Retention Period(in days)
::~~~~~~~~~~~~~~~~~~~~
set retention=3
::Set Log Archive Path(Only Folder Name)
::~~~~~~~~~~~~~~~~~~~~
set logarchivepath=BackupLog
::If ‘yes’ then backup log retention will enabled
::~~~~~~~~~~~~~~~~~~~~
set logretention=yes
::If avove settings is “yes” then set log Retention Period(in days)
::~~~~~~~~~~~~~~~~~~~~
set logretentionperiod=3
::———-x———
::E-Mail Settings (SMTP without authentication will work)
::———-x———
::If ‘yes’ a mail will be fired after backup
::~~~~~~~~~~~~~~~~~~~~
set _mailnotification=yes
::If ‘yes’ backup log will attached with mail
::~~~~~~~~~~~~~~~~~~~~
set attachment=no
::Type your e-mail address(for multiple e-mail ID, use ‘,’)
::~~~~~~~~~~~~~~~~~~~~
set email=urname@domain.com
:: Type from mail ID
::~~~~~~~~~~~~~~~~~~~~
set from=%computername%@TC-Auto-NTBackUP
::Set SMTP Server IP Address
::~~~~~~~~~~~~~~~~~~~~
set mserver=10.0.0.1
::Backup Settings END
Batchfile NTBackup.bat
?Download NTBackup.bat
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
@echo offcolor 0cMODE CON: COLS=50 LINES=11echo ***************************************echo Auto SystemState Backup with Retentionecho Log Archive and Mail Notificationecho Code By : Saugata Dattaecho ~~~echo (c) http://technochat.inecho Date: %DATE%, Time: %TIME%echo ***************************************::Backup Settings START::Set Backup Path::~~~~~~~~~~~~~~~~~~~~set savepath=D:\TestBackup::Set Backup Name::~~~~~~~~~~~~~~~~~~~~set backupname=SysBackup::Set Backup Retention Period(in days)::~~~~~~~~~~~~~~~~~~~~set retention=3::Set Log Archive Path(Only Folder Name)::~~~~~~~~~~~~~~~~~~~~set logarchivepath=BackupLog::If 'yes' then backup log retention will enabled::~~~~~~~~~~~~~~~~~~~~set logretention=yes::If avove settings is "yes" then set log Retention Period(in days)::~~~~~~~~~~~~~~~~~~~~set logretentionperiod=3::----------x---------::E-Mail Settings (SMTP without authentication will work)::----------x---------::If 'yes' a mail will be fired after backup::~~~~~~~~~~~~~~~~~~~~set _mailnotification=yes::If 'yes' backup log will attached with mail::~~~~~~~~~~~~~~~~~~~~set attachment=no::Type your e-mail address(for multiple e-mail ID, use ',')::~~~~~~~~~~~~~~~~~~~~set email=vdco.kolkata@familycreditindia.com:: Type from mail ID::~~~~~~~~~~~~~~~~~~~~set from=%computername%@FC-Auto-NTBackUP::Set SMTP Server IP Address::~~~~~~~~~~~~~~~~~~~~set mserver=172.16.10.7::Backup Settings END::--------------------------------::Don't change following lines.::--------------------------------forfiles -p "%savepath%" /m *.bkf /s /d -%retention% /c "cmd /C del @FILE":: get the date and time and then into single variablefor /F "tokens=1-4 delims=/ " %%i in ('date /t') do (set MM=%%jset DD=%%kset YYYY=%%lset date=%%k-%%j-%%lset dirdate=%%j%%k%%l)for /f "Tokens=1-2 delims=/ " %%i in ('time /t') do (set tm=%%iset ampm=%%j)::Deleting Old Backup Log filesif not exist "%HOMEPATH%\Local Settings\Application Data\Microsoft\Windows NT\NTbackup\Data\*.log" goto _nodeldel "%HOMEPATH%\Local Settings\Application Data\Microsoft\Windows NT\NTbackup\Data\*.log" >nul:_nodelntbackup.exe backup systemstate /v:no /r:no /rs:no /hc:off /J %backupname% /l:s /f "%savepath%\%backupname%_%computername%_%date%.bkf"if not exist "%savepath%\%logarchivepath%" md "%savepath%\%logarchivepath%" >nulmove "%HOMEPATH%\Local Settings\Application Data\Microsoft\Windows NT\NTbackup\Data\*.log" %savepath%\%logarchivepath%\%backupname%_%computername%_%date%.txt >nulif not "%_mailnotification%" == "yes" goto _endif not "%attachment%" == "yes" goto _noattachblat "%savepath%\%logarchivepath%\%backupname%_%computername%_%date%.txt" -attach "%savepath%\%logarchivepath%\%backupname%_%computername%_%date%.txt" -to %email% -s "NT Backup Success/Failure Report of %computername%" -f "%from%" -server "%mserver%" > nulgoto _skip:_noattachblat "%savepath%\%logarchivepath%\%backupname%_%computername%_%date%.txt" -to %email% -s "NT Backup Success/Failure Report of %computername%" -f "%from%" -server "%mserver%" > nul:_skipif not "%logretention%" == "yes" goto _endforfiles -p "%savepath%\%logarchivepath%" /m *.txt /s /d -%logretentionperiod% /c "cmd /C del @FILE":_endexit
Now you have to create a schedule for daily backup.