Wednesday, 17 June 2009

Font Installation using VBscript

The script:
'=========================
'Syntax: "InstallFont.vbs" /Font:""
'=========================
Option Explicit
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(WScript.Arguments.Named.Item("Font")) Then
Dim WSH
Set WSH = CreateObject("WScript.Shell")
'Coping the font file into the system folter Fonts
FSO.CopyFile WScript.Arguments.Named.Item("Font"), WSH.SpecialFolders("Fonts") & "\"
'Installaton of the font using API
WSH.Run "RunDll32.exe gdi32.dll,AddFontResourceA " & FSO.GetBaseName(WScript.Arguments.Named.Item("Font"))
End If

Additional *.bat file used for that task resolve:

REM========определение рабочих путей======
set mainpath=\\comp21\WORK\fontsinstall

REM========creating fontpaths.txt======
del %mainpath%\fontpaths.txt
FOR %%B in ("%mainpath%\fonts\"*.FON) do (echo %%B >> "%mainpath%\fontpaths.txt")
echo "fontpaths.txt is created"

REM========removing the fonts======
FOR /F "tokens=1-5 delims=\" %%B in (%mainpath%\fontpaths.txt) do (echo %%F removed & del %windir%\fonts\%%F)

REM========font installation======
FOR %%B in ("%mainpath%\fonts\"*.FON) do (%mainpath%\fontsinstall.vbs /Font:%%B & echo Font %%B is installed)

Thursday, 11 June 2009

Service Remote Start/Stop


Question: How to start/stop a service on a remote computer?

Answer: Using sc from command line.

examples:

  • sc \\Server1 start/stop "Service Number One"
  • runas /user:Domain1\admin "sc \\Server1 start \"Service Number One\""

Thursday, 14 May 2009

Recovery Boot.ini file

For example, you have a machine that has two hard disks - Disk0 and Disk1. Each disk is connected to a separate controller. System files are located on Disk1.

You add a third had disk. You configure the new hard disk as a basic disk and format it with NTFS.

When you restart the machine, you recieve the following message:

"Windows could not start because of a computer disk hardware configuration problem. Could not read the selected boot disk. Check boot path and disk hardware ..."

What should you do?

Adding the extra hard disk has probably caused the problem. The boot.ini file needs to be corrected to reflect the new disk configuration. 

- Use the Windiws XP CD-ROM to start your computer.

- When you recieve the message to press R to repair Windows by using the Recovery Console, press the R key.

- Select the Windows installation that you want, and then type the administrator password when prompted.

- Type bootcfg /rebuild, and then press ENTER/

- When the Windows installation is located, the following instructions are displayed:

  Add installation to boot list? (Yes/No/All)

  [Type Y response to this message]

Tuesday, 5 May 2009

Recovering Windows BootSector (the easy way)


The way of recovering Windows boot sector, - quick and less distructable that the way of booting up from Windows instalation disk and pressing R.

  1. Download that archive bootsectorwintools.rar
     
    Create a boot disk (any you may find in Inet).  Downloaded archive unpack and move  into the boot disk befor burning. You may choose any folder.
  2. Boot up from that disk.
  3. Open the comand line (cmd.exe) and run these comands:
  • for Windows XP

    path\to\the\folder\bootsectorwintools\bootsect.exe /nt52 all

  • for Windows Vista

    path\to\the\folder\bootsectorwintools\bootsect.exe /nt60 all

After that reboot your machine and Bingo !!!

You may find a few cool programs for that kind of troubles - read help.