<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; WSH: установка владельца файла с помощью File Owner Component]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=2808</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=2808&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «WSH: установка владельца файла с помощью File Owner Component».]]></description>
		<lastBuildDate>Thu, 19 Feb 2009 20:07:49 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[WSH: установка владельца файла с помощью File Owner Component]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=19741#p19741</link>
			<description><![CDATA[<p>Бесплатный COM-сервер <strong>File Owner Component</strong> от компании SAPIEN позволяет легко прочитать и установить владельца файла или папки. Компонент доступен на странице <a href="http://www.primaltools.com/freetools/">http://www.primaltools.com/freetools/</a>. При переходе по ссылке для скачивания вас просят указать имя и e-mail, после чего добрый человекоподобный робот присылает на e-mail собственно ссылку на скачивание <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />. Архив имеет размер менее 15 Кб. Файл <strong>FileOwner.dll</strong> следует зарегистрировать с помощью <strong>regsvr32.exe</strong>. Пример использования (есть и в архиве):<br /></p><div class="codebox"><pre><code>Set ownerobj = CreateObject(&quot;SAPIEN.FileOwner&quot;)
PreviousOwner = ownerobj.GetOwner(&quot;C:\Temp\Testing\test.vbs&quot;)
WScript.Echo PreviousOwner
If ownerobj.SetOwner(&quot;TestUser&quot;, &quot;C:\Temp\Testing\test.vbs&quot;) Then
    WScript.Echo &quot;User set to TestUser&quot;
Else
    WScript.Echo &quot;Setting User failed&quot;
end If
ownerobj.SetOwner PreviousOwner, &quot;C:\Temp\Testing\test.vbs&quot;

&#039; Точно так же работаем с папками:
PreviousOwner = ownerobj.GetOwner(&quot;C:\Temp\Testing&quot;)
WScript.Echo PreviousOwner
If ownerobj.SetOwner(&quot;TestUser&quot;, &quot;C:\Temp\Testing&quot;) Then
    WScript.Echo &quot;User set to TestUser&quot;
Else
    WScript.Echo &quot;Setting User failed&quot;
end If
ownerobj.SetOwner PreviousOwner, &quot;C:\Temp\Testing&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (The gray Cardinal)]]></author>
			<pubDate>Thu, 19 Feb 2009 20:07:49 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=19741#p19741</guid>
		</item>
	</channel>
</rss>
