�������� � SMS Installer Script Editor

������ "Windows 2000 Magazine" , #02/2000
���� ������

��������� ������������ ���������������� ������ �������������� ���� ����� � ������� Microsoft Systems Management Server (SMS) Installer, ������� ������������ � ������� SMS 2.0. ������� � �������� Installation Expert, ��� �������� ������ � �������� ������������ ����������, �������������� �������� ��� ������������ ����� �������� ���������, ������� ��������� ������, �������� ������� � ��������� ���������� �������. ��� �� �����, ���� Installation Expert ������� ����������� �� ������ �������������, �������� ����� ����������� SMS Installer ������������ ��� ������ � ���������� ��������� Script Editor. ��� ����� ����������� �������� ��� ������������ ������������ �������, ��������������� �������������� �����������, ������� ��� � �������. ��������, ���� ������������� ��������� ������������ � ����� ������� ��������� ��������� �������� (������, ����������� if...then), �� ������ ������ �� � ������� �������� � ������� ���������. ��� �� ���������, ���� ���� ����� � ����������� �������� ���������� ���������� ����� ��������� � ������, ���� ���������: ������ ��������� ��������� �������� �� ����������� ���������� � ���������� �� ����� ������� ���������� ����������������.

���������� � ���������� ���������

������� ������������ ���������� Script Editor, ������ � �������� �������������� �� ���� View, ������� �� ���� �������. �� ����� ������ �������� ������ ���� ��������� �������� (���������� ������ ��� ��������), ������� ����� ��������� ������������ �����.

����� 1. ��� ���� Script Editor.

� ����� �������� ���������������� �������� ��������� ��������� ���������� �����, ��������� ������, �������� ������� � ��������� �������. �� ������ ������, ��� �������� �� ������ 1, ������������ �������� ��������. � ������� ����� ���� ����������� ������ ���� � ������ ������������, ���������� ��������� ������� File � Edit, � ����� ����� ������� ������ ��������.

���������� ����� �������� ������������� ������ - �������������� ��������� �������� �������� � ������� ��������� � ������ Installation Expert ������� ������������ (repackage wizard). ���� ����� �������� ������ ������� � ���� ��������� ���������, � ������ ������ ���� �������� ����� ��������, ������������ ��� ��������������� �������� ��������. ������ ������ �������� ����� ��������������� ����� ��������.

�������� 40 ��� 50 ������ ����� ��������� ����� ���������������� ��������, ��� ���������� ���������� � ����������� ��������� ���������� ���� �������. �� � ���� ������ �� ������� ������ ��� ������� ��� ������, ��������� ��� ����������� ������ ��� ������ ��������. ��������, ���� ������������ ����� ���������� � ���� ����������� ������� ���������� ���������, �������� �� ����� ��������������� ��� ������� Check Disk Space (�������� ��������� ������������).

���� ��� �������� ������������� ������ ������������� ������, �������� ����� ��������� ����� ��� ������ Install File (��������� �����), ������ �� ������� ������������� �������� ����������� ����������� ����� ������������� ������ �� ���������� ���������. � �������������� ����� ��������, ��������� �����, �������� ��������� ������ Create Shortcut (�������� ������) � Edit Registry (�������������� �������), ����, �������, ��� ������� �� ���� ���������������� ����������.

���������� ��������� �������� �������� � �������� �������������� �������. ����� ������� ����� - "����������" �� ����� � ����� ������ �� ������, � ������ ������ ��������. ���� Script Editor ���������� ��������� ���� ���������, ������ � ��������� ������� � ������� ���������� ����. ��� ���������� ��� ��������� ������� ���������� ���������� ���� ��������������, ���������� ����� ����������� �������� ����������, ��� ������ � �������������� ����.

����������

����� �� �������� �������� ������������ SMS Installer �������� ����������� ��������������� ������������� ���������� ��� ����������� ������� ���������. ��������, � �������� �������� ������������� ������ ��� ���������� � ������������ �������� Windows 9x, ����� ������� ��������� � �������� C:\Windows\ System, SMS Installer ������� ��� ������ �� ��� ����� ���������� SYS. ���������� ���������� "��������������" - ���� ���������� ������ ����� �� ��������� � ������������ �������� Windows NT, ����� ����� ����������� ����, ���� ����� - � ������� \Winnt\System32. ����� ��� �� ������������ ����� ����� �������� ������ � ������� ������������� ���������� ������������, � �� ���������� �� � �����-�� ����� �������.

��, ��� ����������� � �������� �������������� �������, ����� � ������� ���� �������� ������� ���� ������ ����� ���������. �����������, ��������� ���������� ������������ ���������� ��� ������������� Microsoft Internet Explorer (IE). �������, ������ �������� ������� ������������ �����, ������� ��������� ���������� � ������� Program Files\ Internet Explorer\Plugins. ���� ����� ����� �������� � ����������� �������, ������ ���� IE ����������, ��������, � �������� D:\IE4 ��� C:\Program Files\Plus!\Microsoft Internet, �� ��������� ����� �� �������.

����� 2. ����������� ����������������� Internet Explorer.

����� DLL �������� �� ��� ���������� �� � ��� �������, �����, ��� �������� �� ������ 2, �������� ��� �������� IE � ������� ������� Get Registry Key Value, ������� ��������� ��� �� ���������������� ����� ������� � �������� ����������.

����� 3. ������� ���� ��� ����������� ������ � ������� ���������� IEPATH.

��� ���� ����������, �������� IEPATH, ����� ������������ � ���� ��������� ������ (��. ����� 3). ���� � �������� IE ������ � ����� �� ���������� ������� ������� HKEY_LOCAL_MACHINE\SOFTWARE \Microsoft\IE Setup\Setup (��. ����� 2). ���������� �������� ����� ��������� � ���������� IEPATH, ����� ��������������� �������� ����������� ����� ���������� � ������� %IEPATH%\ Plugins. ����� ������ �����������, ��� ������������ ����� ����� �������� � ���� ������������� ���������� �� ����, ��� �� �� ����������� ���������� Internet Explorer.

��������, ����������� ��������� ����� �� ������������ ������� � ������� ������ ���������� (��������, ����� �������� IE). ����� ����, �������� �������������� ������ �������� � ���������� ��������������, ����� ��������� � ������������ ��������� ���������� �������. ��������, ���� �� ���������� ����������� ������ IE 3.0, ������ � �������� ��������� � ������� �����������. ������� ���������� �������� ������� ���� ��� ������������� ��������� � ����������� ������ IE.

�������� ���������

������, ��� �����-���� ��������� �����������������, ��������, ��������� ����� ����������� if...then. �� �����������, ��� ��������� ��������� �������� ��������� ��������������� ������������ ������������� SMS Installer. ��� ����� ����������� ��� �������, ��������, ����� ������, ��� ��������� ������ � ����������� �� ���� ������������ �������. ����� ����, ��� �������� ������� ��������� ������� ��������� � ������ ���������� � ������� ���������� ���������� ��� ��������� ��������� �������� � ����������� �� ������� ������ ������������.

����� 4. ������������� ����������� ����������.

� ������������ If/While ����� ��������� ����������� ��������� (��������, Equals, Contains), ����������� ���������� ���������� � �������� ��������� (��. ����� 4). �������� ����� ������������ ��������� ��������� ��� ������� ����� If ��� ����� While, ������ �������� ������� ��������, ���������� ���������� ��� �������������� �������. �������� ����������� ����������� �������� End Block.

� ����� �������� ���������� ����� ������� � ��� ������ ������. ��������, ������� �������� ������������ Check Configuration �������� ��� ���������� �������� � ����������� �� ����, ����� ������ ������� ������������. �� ����, ��� ������ ���� ����� If, ������� ���������, ��������, ����� ��������: "���� �� ���������� ����������� ������������ ������� Windows 95, ���������� ��������� ������". �� ��������������, ������� ��������� ��������� SMS ��� ����������� ����� �������, ������ ������� � ���, ��� SMS �������� ��������� ������������ ����������� �������, ������������� � ������������, �������� �� ��������� ������ ������� �� �����������, ��� ����������� �� Windows NT ��� Windows 9x, � �����-���� ���� �������. ��� ������������ �������������� ������ ���������� ������� �������� � ����� If �������� �������� Else, � ��������� �� ��� ������� ����� ����������� � ������, ����� ������� ��������� If �� �����������. ��������:

If <�������>
    <�������1>
Else
   <�������2>
End Block

������ �������� ������� � ����������

������������� ����������, ������������� ������� � �������� ���������� �������� �� 99% ����������� ��� ������ ��������� ���������. ���������� �� � ���������� ��������� ������� ����� ��� �������� ������ � ����������.

Delete File(s). ���� ������ ��������� ������������� ����� �� ���������������� �������, �� �� ����������� ���������� �������� ������������ ������. ��� ����� ����� ��������� ������� Delete File(s) (������� ����(�)) ��������� ���������.

����� 5. ������� ����� ��� ��������.

�����������, ��������� ������� ���������� ��� "������ ������" � �������. ��� ���� ����������, ����� ����� ������������ �������������� ������ ��������� Microsoft Find Fast (�� ����� ������������). ��� �����, ��� �������� �� ������ 5, ����� �������� � �������� ������� Delete File, ������� ������� ����������, � ����� �������� ��������� ��������� ������. ����� ������� ��������������� �����, ����� ������������ ���� ����������� ����������, ������� ���� �������������� ��������, ���� ����������� ���������� SMS Installer STARTUPDIR.

��� �������� ������� ��������� ������ ��������� ��������� ������� �������, ��� ������ ����������� ��� ������ � ���������� ���������� \Windows � \Winnt\System32. ����� ����, ���������� ���� ������� Delete File(s) �������� ��� �������, ����������� ������� �������� � ����� �� ��������� ���������.

� ��������� ������� SMS Installer ������ ������ � ���������� � �������� ��������� ��������� ����� ��������������� �����������. � ���, ��� ������ �������� ��������, ���������� � ������ Microsoft "SMS: Remove Directory Containing Files Option in 'Delete Files' Script Item Not Functioning Properly", ������� ����� ����� �� ������: http://support.microsoft.com/support /kb/articles/q235/7/48.asp. ����� ��������� �������� � ����������� "���������" ��� SMS Installer ��������� � ������ "SMS Installer Fixes". ��������� ������ � ������ ������� Delete File(s) ��������� ���������� � ������ SMS Installer 2.0.91.00, � ������� ����� �������� �������� ������� � ����� ��� ����� ������, � ��� ����� ��� ���������� ������.

Parse String. ������ ��������� ������������� ������������ ������ ����� ���������� ��� ��������� ���� ���������� �� ���. �������� �������� ����� ��������� � ������� ������� ������� ������ Parse String, ������� ������� ��� ��������� ����������, ����������� �� �������� ���������� ������� ������� ��� ������� ���������.

��������, ��� ����������� ������� ���������� �������� �������� ���������� "�����" ����� ������ �������������� ����������. ����������� �����, ��� �������� �������� �������, ������� ��������� ���� ����� (��������, 2.0.1.b ��� 3.0.5a). ���� ��������� ������ �������� ����� ������ (��������, 2.� ��� 3.�), ����� �������� ������ � ������ ������� � ������� � �������� ������ ������ ��� ������. ��� ����� � ������� ��������� Split value ������� Parse String ����� ������� ����� ������� ������ �����, � ��������� Pattern/Position ��������� �������� 1. � ���������� ������� �������� �� ������ ������ ������ � ������� ������ � �������� ��� � ��������� ����������. ����� ����� ����� ������������ �������� �������� ��� ����������� ��������� �������� � ����������� �� �������� ����������.

Include Script. ���� ���� ������� ��������� �������� �� ���������� ��������, ����� ����� ��������������� ��, ����� ��������������� �������� ��������� �������� Include Script. ��� ������� �� ��������, ������� ��������� � ����������� �������� ���� ������� ��������. ��������, SMS Installer ���������� ������ �������� ��� ��������� � ����� ������� �������� ���������������� ����������. ��� ����� SMS Installer ��������� � �������� ���� uninstal.ipf, ������� �������� ���� ��������������� ������� �������� � ���������� ����������� ��������� � ������. ��� ��������� ������� ������������� ���������� � ������� ������ Add/Remove Programs ������ ����������. ������� SMS ����� ������������ ��� ����������� ��� ��������������� �������� ����������, ���������� �������� SMS ������ �� ������������.

RESTART. ������, ����� �������� ��������� ����� �������, ��� ������ ���������� ����� ��� ����������� ����� autoexec.bat, ������������ ����� ���������� ������������ ������������� ������� ����� ���������� ���������. ��� ������������� ����� �������� ������������ ���������� RESTART, ������� ����������, ����� �� ����� ��������� ������������. ���� ������ ���������� ��������� ������ ��������, ����������� �� �����. ����� ����������� ��� �����������, � ����� �������� ������� �������� ������� Set Variable, ������������� ���������� RESTART �������� ' ' (������). ��� ���� ����� �������, ��� ������ ���������� ����� ����������� �������� �� ������������ �������. ������ ���� SMS ������������ ��� �������������� ������������� ������ ���� ����������, ����� �������� ������������ �� ���������� ��������� ���������� �� ���.

����� ����, ����� ������������ ���������� RESTART ��� ���������� �������������� ������������ ����� ��������� ������, ������� �� ������� ����������� �������. ��� ����� ����� ��������� RESTART �������� S. ����� ����, ���� ����������� ����������� ���������������� ������, �� ����� ���������������� ����������� ��������� SMS ����� �������, ����� ������������ �������������� ������������� ��� ������������� ���������� RESTART.

"������ ������"

���������� �� ����, � ��� �������� ������������ - � ���������� ��������� ��� � ��������, - ����� �������������� ������������ ������� ����������� ����� ����������� "������ ������": ������������� ������ ��������������� ������� ������, ������� ����� � ������� � �����, ������� ������� ��������� ��������� ��������� (��������, ������� SMS ��� ������������ ��������). ���� � �������� ���������� ������ ����� ���������� �����������, �������������� ��������� �������� ������, ������� �������� ������� �� ��������.

����� ��������� ������������� �������� ������ � ���������� �������, ����������� � ����������� ������������. ���, ���� ������ ���������� ������� ������� � ������ ������ ������������ jsmith, �� ���������, ��� �� ������� ��������� ������� � ������ HKEY_USERS\jsmith ��� ������� ������������� ����� � ������� jsmith.

���� ��� ������������� ������������� ������ ������������ ��������������� ����������� ��� ��������, ���������� ������� � ������ ������ Uninstall, ������� ������������ ������� Add/Remove Programs ������ ����������. ���� ����� ������������ ��� ����������, ������� ��� ������������ ����� ��������, ������� ������ �� ���� Start ������ ��������� Uninstall, ����� ��������� ����������� ������� � ���� ������ ������� ��������.

������� � ���������� ��������� SMS Installer, ������������ ����� � ����� ������������ ����� ������ � ������ ����� �������, ��� ��� ������ ������ � ��������. � ������� �������� ���������� � ����������, ����� ��������� �������� ������ ����������� ����������, ������������ ����������� ������� �������� �� ����������� ������������ ���������� ������.