<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS: Создание локального юзера, "connect as" in IIS, создание в MSSQL]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=5017&amp;type=atom" />
	<updated>2010-10-08T14:55:32Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=5017</id>
		<entry>
			<title type="html"><![CDATA[VBS: Создание локального юзера, "connect as" in IIS, создание в MSSQL]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40169#p40169" />
			<content type="html"><![CDATA[<p>День добрый, мастера технологий! </p><p>Есть в наличии несколько серверов Windows 2008(64bit) c ASP.NET. (IIS7, MSSQL 2008).<br />Периодически требуется заводить нового юзера:<br />- в системе <br />- в IIS (вот тут просто не знаю как)<br />- а затем на SQL сервере</p><p>Первая часть такая:<br /></p><div class="codebox"><pre><code>&#039;Username
strAccount = &quot;my_test_user&quot;
&#039;Password
strPswd = &quot;Rddlj3vty7&quot;
Set objNetwork = CreateObject(&quot;Wscript.Network&quot;)
strComputer = objNetwork.ComputerName
&#039; Check if account already exists
intExists = 0
Set colAccounts = GetObject(&quot;WinNT://&quot; &amp; strComputer &amp; &quot;&quot;)
colAccounts.Filter = Array(&quot;user&quot;)
For Each objUser In colAccounts
If objUser.Name = strAccount Then
intExists = 1
End If
Next
If intExists = 0 Then
&#039; Creating user
Set colAccounts = GetObject(&quot;WinNT://&quot; &amp; strComputer &amp; &quot;&quot;)
Set objUser = colAccounts.Create(&quot;user&quot;, strAccount)
&#039; Set password
objUser.SetPassword strPswd
objUser.SetInfo
&#039; Password parameters
Set objUser = GetObject(&quot;WinNT://&quot; &amp; strComputer &amp; &quot;/&quot; &amp; strAccount &amp; &quot;,User&quot;)
objUserFlags = objUser.Get(&quot;UserFlags&quot;)
objPasswordExpirationFlag = objUserFlags Or ADS_UF_DONT_EXPIRE_PASSWD
objUser.Put &quot;userFlags&quot;, objPasswordExpirationFlag
objUser.SetInfo
&#039; Add to required local Windows group
Set objGroup = GetObject(&quot;WinNT://&quot; &amp; strComputer &amp; &quot;/IIS_IUSRS,group&quot;)
Set objUser = GetObject(&quot;WinNT://&quot; &amp; strComputer &amp; &quot;/&quot; &amp; strAccount &amp; &quot;,user&quot;)
objGroup.Add(objUser.ADsPath)
End If</code></pre></div><p>Третью часть планирую сделать с помощью sqlcmd.exe.</p><p>Помогите пожалуйста завести юзера скриптом в IIS7? Хочется именно прикрепить его (юзера) на конкретный сайт (Mysite - Basic settings - &quot;connect as&quot;)</p><p>С уважением</p>]]></content>
			<author>
				<name><![CDATA[vadik72]]></name>
			</author>
			<updated>2010-10-08T14:55:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40169#p40169</id>
		</entry>
</feed>
