<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBScript: определение версии операционной системы]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=52&amp;type=atom" />
	<updated>2006-07-13T08:11:51Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=52</id>
		<entry>
			<title type="html"><![CDATA[VBScript: определение версии операционной системы]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=77#p77" />
			<content type="html"><![CDATA[<p>Пример скрипта:<br /></p><div class="codebox"><pre><code>Set objWMIService = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2&quot;)
If Err.Number &lt;&gt; 0 Then
    WScript.Echo Err.Number &amp; &quot; &quot; &amp; Err.Description
    WScript.Quit
End If
Set colOperatingSystems = objWMIService.ExecQuery(&quot;Select * from Win32_OperatingSystem&quot;)
strInfo = vbNullString
For Each objOperatingSystem in colOperatingSystems
    strInfo=objOperatingSystem.Caption &amp; &quot; &quot; &amp; objOperatingSystem.Version
    Exit For
Next
WScript.Echo strInfo</code></pre></div><p>А вот так это можно сделать из 1С v7.7:<br /></p><div class="codebox"><pre><code>Попытка
    ScrptCtrl=СоздатьОбъект(&quot;MSScriptControl.ScriptControl&quot;);
    ScrptCtrl.Language=&quot;vbscript&quot;;
    ScrptCtrl.AddCode(&quot;
    |Function GetVer()
    |    Set objWMIService = GetObject(&quot;&quot;winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2&quot;&quot;)
    |    Set colOperatingSystems = objWMIService.ExecQuery(&quot;&quot;Select * from Win32_OperatingSystem&quot;&quot;)
    |    strInfo=vbNullString
    |    For Each objOperatingSystem in colOperatingSystems
    |        strInfo=objOperatingSystem.Caption &amp; &quot;&quot; &quot;&quot; &amp; objOperatingSystem.Version
    |        Exit For
    |    Next
    |    GetVer=strInfo
    |End Function
    |&quot;);
    ТекстВерcии=СокрЛП(ScrptCtrl.Run(&quot;GetVer&quot;));
    Сообщить(ТекстВерcии);
Исключение
    Сообщить(ОписаниеОшибки());
КонецПопытки;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[The gray Cardinal]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=2</uri>
			</author>
			<updated>2006-07-13T08:11:51Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=77#p77</id>
		</entry>
</feed>
