<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to create Windows user with Powershell?</title>
	<atom:link href="http://www.yusufozturk.info/windows-server/how-to-create-windows-user-with-powershell-2.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.yusufozturk.info/windows-server/how-to-create-windows-user-with-powershell-2.html</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 08 Sep 2010 21:42:36 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: kiran</title>
		<link>http://www.yusufozturk.info/windows-server/how-to-create-windows-user-with-powershell-2.html/comment-page-1#comment-1873</link>
		<dc:creator>kiran</dc:creator>
		<pubDate>Mon, 26 Jul 2010 13:38:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.yusufozturk.info/?p=1145#comment-1873</guid>
		<description>you might want to add an additional if statement at the end to actually verify if the user got created or  not.

I ran this today on localhost and got an error and still got the output user created which obviously wasnt right.

function create-user($username, $password)
	{
		
        $computer = [ADSI]&quot;WinNT://localhost&quot;
		foreach ($user in $computer.psbase.children)
			{
				if ($user.Name -eq $username)
					{
						Write-Host $user.Name &quot;already exist.&quot;
						Return
					}
			}
		$user_obj = $computer.Create(&quot;user&quot;, &quot;$username&quot;)
		$user_obj.Put(&quot;description&quot;, &quot;$username&quot;)
		$user_obj.SetInfo()
		$user_obj.SetPassword($password)
		$user_obj.SetInfo()
		$user_obj.psbase.invokeset(&quot;AccountDisabled&quot;, &quot;False&quot;)
		$user_obj.SetInfo()
                if ($user.Name -eq $username)
					{
						Write-Host &quot;$username created.&quot;
						Return
					}
		              else
                      {
                        Write-host &quot;Error Creating $username&quot;
                      }
	}</description>
		<content:encoded><![CDATA[<p>you might want to add an additional if statement at the end to actually verify if the user got created or  not.</p>
<p>I ran this today on localhost and got an error and still got the output user created which obviously wasnt right.</p>
<p>function create-user($username, $password)<br />
	{</p>
<p>        $computer = [ADSI]&#8220;WinNT://localhost&#8221;<br />
		foreach ($user in $computer.psbase.children)<br />
			{<br />
				if ($user.Name -eq $username)<br />
					{<br />
						Write-Host $user.Name &#8220;already exist.&#8221;<br />
						Return<br />
					}<br />
			}<br />
		$user_obj = $computer.Create(&#8220;user&#8221;, &#8220;$username&#8221;)<br />
		$user_obj.Put(&#8220;description&#8221;, &#8220;$username&#8221;)<br />
		$user_obj.SetInfo()<br />
		$user_obj.SetPassword($password)<br />
		$user_obj.SetInfo()<br />
		$user_obj.psbase.invokeset(&#8220;AccountDisabled&#8221;, &#8220;False&#8221;)<br />
		$user_obj.SetInfo()<br />
                if ($user.Name -eq $username)<br />
					{<br />
						Write-Host &#8220;$username created.&#8221;<br />
						Return<br />
					}<br />
		              else<br />
                      {<br />
                        Write-host &#8220;Error Creating $username&#8221;<br />
                      }<br />
	}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.yusufozturk.info/windows-server/how-to-create-windows-user-with-powershell-2.html/comment-page-1#comment-1727</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Mon, 15 Feb 2010 20:14:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.yusufozturk.info/?p=1145#comment-1727</guid>
		<description>Hello Herry,

You need to have admin privileges on all remote servers. You can set same username and password on all servers or you can join them to an active directory. Using PSexec or Remote Powershell are other options.</description>
		<content:encoded><![CDATA[<p>Hello Herry,</p>
<p>You need to have admin privileges on all remote servers. You can set same username and password on all servers or you can join them to an active directory. Using PSexec or Remote Powershell are other options.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.yusufozturk.info/windows-server/how-to-create-windows-user-with-powershell-2.html/comment-page-1#comment-1722</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sat, 13 Feb 2010 10:02:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.yusufozturk.info/?p=1145#comment-1722</guid>
		<description>Hello Herry,

I wrote a script to create user remote host. I&#039;ll try to post you today, it&#039;s on office pc.

But you can try Remote Powershell for all scripts. Just google for New-PSSession and Enter-PSSession.

See you.</description>
		<content:encoded><![CDATA[<p>Hello Herry,</p>
<p>I wrote a script to create user remote host. I&#8217;ll try to post you today, it&#8217;s on office pc.</p>
<p>But you can try Remote Powershell for all scripts. Just google for New-PSSession and Enter-PSSession.</p>
<p>See you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heriyanto</title>
		<link>http://www.yusufozturk.info/windows-server/how-to-create-windows-user-with-powershell-2.html/comment-page-1#comment-1709</link>
		<dc:creator>Heriyanto</dc:creator>
		<pubDate>Tue, 09 Feb 2010 05:13:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.yusufozturk.info/?p=1145#comment-1709</guid>
		<description>what about to create user on remote host (server)?
i&#039;ve tried to replace the
$computer = [ADSI]&quot;WinNT://localhost&quot;
to
$computer = [ADSI]&quot;WinNT://192.168.1.10&quot; but i got this error :
Exception calling &quot;SetInfo&quot; with &quot;0&quot; argument(s): &quot;Logon failure: unknown username or bad password. (Exception from HRESULT: 0x8007052E)&quot;
At line:14 char:26
+         $user_obj.SetInfo &lt;&lt;&lt;&lt; ()
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : CatchFromBaseAdapterMethodInvokeTI


please help me!

thanks.</description>
		<content:encoded><![CDATA[<p>what about to create user on remote host (server)?<br />
i&#8217;ve tried to replace the<br />
$computer = [ADSI]&#8220;WinNT://localhost&#8221;<br />
to<br />
$computer = [ADSI]&#8220;WinNT://192.168.1.10&#8243; but i got this error :<br />
Exception calling &#8220;SetInfo&#8221; with &#8220;0&#8243; argument(s): &#8220;Logon failure: unknown username or bad password. (Exception from HRESULT: 0x8007052E)&#8221;<br />
At line:14 char:26<br />
+         $user_obj.SetInfo &lt;&lt;&lt;&lt; ()<br />
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException<br />
    + FullyQualifiedErrorId : CatchFromBaseAdapterMethodInvokeTI</p>
<p>please help me!</p>
<p>thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
