<?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: Get-AD.ps1</title>
	<atom:link href="http://www.powershell.nu/2009/02/27/get-adps1/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.powershell.nu/2009/02/27/get-adps1/</link>
	<description>Windows PowerShell</description>
	<lastBuildDate>Fri, 03 Feb 2012 09:00:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Fabrice</title>
		<link>http://www.powershell.nu/2009/02/27/get-adps1/comment-page-1/#comment-9712</link>
		<dc:creator>Fabrice</dc:creator>
		<pubDate>Mon, 10 Oct 2011 12:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=491#comment-9712</guid>
		<description>Another question...
Is it possible to query all computers in the domain and receive as result not only their Computernames but also their Operating system, service pack and eventually the OU where they belong?
Regards!</description>
		<content:encoded><![CDATA[<p>Another question&#8230;<br />
Is it possible to query all computers in the domain and receive as result not only their Computernames but also their Operating system, service pack and eventually the OU where they belong?<br />
Regards!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabrice</title>
		<link>http://www.powershell.nu/2009/02/27/get-adps1/comment-page-1/#comment-9711</link>
		<dc:creator>Fabrice</dc:creator>
		<pubDate>Mon, 10 Oct 2011 12:40:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=491#comment-9711</guid>
		<description>Hi Niklas,
Very nice script, just what I was looking for. I just have a small issue, not really an issue though... When searching computeraccounts in AD it gives me only 1000 records, is it possible to counter this limit?

Regards</description>
		<content:encoded><![CDATA[<p>Hi Niklas,<br />
Very nice script, just what I was looking for. I just have a small issue, not really an issue though&#8230; When searching computeraccounts in AD it gives me only 1000 records, is it possible to counter this limit?</p>
<p>Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert</title>
		<link>http://www.powershell.nu/2009/02/27/get-adps1/comment-page-1/#comment-9046</link>
		<dc:creator>Robert</dc:creator>
		<pubDate>Thu, 01 Sep 2011 16:10:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=491#comment-9046</guid>
		<description>Well that fixed itself when I closed and then reopened PowerShell.  :) lol

One other question... any recommendations on how to search for computers in an OU in a domain without searching other OUs?  I have tried:

-Domain test.com OU group1 -computers AllComputers -ToCsv test.csv 

but all it returns is the OU information.  I have also tried to run the following:

-Domain test.com -computers AllComputers -CustomAll &quot;(&amp;(ObjectCategory=OU)(OU=group1))&quot;

This too returns values on all objects in the domain, not just the OU.</description>
		<content:encoded><![CDATA[<p>Well that fixed itself when I closed and then reopened PowerShell.  <img src='http://www.powershell.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  lol</p>
<p>One other question&#8230; any recommendations on how to search for computers in an OU in a domain without searching other OUs?  I have tried:</p>
<p>-Domain test.com OU group1 -computers AllComputers -ToCsv test.csv </p>
<p>but all it returns is the OU information.  I have also tried to run the following:</p>
<p>-Domain test.com -computers AllComputers -CustomAll &#8220;(&amp;(ObjectCategory=OU)(OU=group1))&#8221;</p>
<p>This too returns values on all objects in the domain, not just the OU.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert</title>
		<link>http://www.powershell.nu/2009/02/27/get-adps1/comment-page-1/#comment-9045</link>
		<dc:creator>Robert</dc:creator>
		<pubDate>Thu, 01 Sep 2011 15:16:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=491#comment-9045</guid>
		<description>I am getting the same error as listed above when trying to use this to get a listing of all computers via OU by name and description.  I have tried the recommendations above but it is not working... the command I am running is this:

c:\Scripts\Get-AD.ps1 -Domain OU.domain.com -User AllGroups -Property name, description -ToCsv c:\scripts\list.csv

Do you have any recommendations?</description>
		<content:encoded><![CDATA[<p>I am getting the same error as listed above when trying to use this to get a listing of all computers via OU by name and description.  I have tried the recommendations above but it is not working&#8230; the command I am running is this:</p>
<p>c:\Scripts\Get-AD.ps1 -Domain OU.domain.com -User AllGroups -Property name, description -ToCsv c:\scripts\list.csv</p>
<p>Do you have any recommendations?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.powershell.nu/2009/02/27/get-adps1/comment-page-1/#comment-4839</link>
		<dc:creator>John</dc:creator>
		<pubDate>Wed, 09 Feb 2011 22:18:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=491#comment-4839</guid>
		<description>I have only been messing with the Get-AD.ps1’s ability to find computers in AD but when I do a search for a computer name not found in the domain I get the following error:
 
PS C:\&gt; .\get-ad.ps1 -Domain &quot;mydomain&quot; -Computer &quot;ComputerName&quot;
You cannot call a method on a null-valued expression.
At C:\get-ad.ps1:630 char:59
+             $SearchResult = ($Searcher.FindOne()).GetDirectoryEntry &lt;&lt;&lt;&lt; ()
    + CategoryInfo          : InvalidOperation: (GetDirectoryEntry:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
I know the error is here but wanted to put in an if statement that sets variable to “No object found” and displays it to host.
 
Code snippets
 
# Collect Information through DirectorySearcher
 
$Searcher.Filter = $SearchFilter
$SearchResult = ($Searcher.FindOne()).GetDirectoryEntry()  &lt;this is where it happens but do not know how to check if method is null.
 
It also would pop 3 other errors in addition to the one posted above but I was able to add
 
# Return Information to Host
 
        if ($Property -eq &quot;AllProperties&quot;) {
 
        $ObjectPropertyNames &#124; ForEach {
 
        $Name = $_
        if ($Name -eq $null) {} else { #Jb edits to keep the errors down
        $Name = $Name.ToString()
 
        $Value = $ObjectProperties[$Name]
        $Value = $Value.ToString()
 
        if($Value -eq $Null) {
                $Value = &quot;Unknown&quot;
        }
 
        $ADObject &#124; Add-Member -memberType NoteProperty $Name -Value $Value
}}
 
 
Thank you</description>
		<content:encoded><![CDATA[<p>I have only been messing with the Get-AD.ps1’s ability to find computers in AD but when I do a search for a computer name not found in the domain I get the following error:</p>
<p>PS C:\&gt; .\get-ad.ps1 -Domain &#8220;mydomain&#8221; -Computer &#8220;ComputerName&#8221;<br />
You cannot call a method on a null-valued expression.<br />
At C:\get-ad.ps1:630 char:59<br />
+             $SearchResult = ($Searcher.FindOne()).GetDirectoryEntry &lt;&lt;&lt;&lt; ()<br />
    + CategoryInfo          : InvalidOperation: (GetDirectoryEntry:String) [], RuntimeException<br />
    + FullyQualifiedErrorId : InvokeMethodOnNull</p>
<p>I know the error is here but wanted to put in an if statement that sets variable to “No object found” and displays it to host.</p>
<p>Code snippets</p>
<p># Collect Information through DirectorySearcher</p>
<p>$Searcher.Filter = $SearchFilter<br />
$SearchResult = ($Searcher.FindOne()).GetDirectoryEntry()  &lt;this is where it happens but do not know how to check if method is null.</p>
<p>It also would pop 3 other errors in addition to the one posted above but I was able to add</p>
<p># Return Information to Host</p>
<p>        if ($Property -eq &quot;AllProperties&quot;) {</p>
<p>        $ObjectPropertyNames | ForEach {</p>
<p>        $Name = $_<br />
        if ($Name -eq $null) {} else { #Jb edits to keep the errors down<br />
        $Name = $Name.ToString()</p>
<p>        $Value = $ObjectProperties[$Name]<br />
        $Value = $Value.ToString()</p>
<p>        if($Value -eq $Null) {<br />
                $Value = &quot;Unknown&quot;<br />
        }</p>
<p>        $ADObject | Add-Member -memberType NoteProperty $Name -Value $Value<br />
}}</p>
<p>Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Niklas Goude</title>
		<link>http://www.powershell.nu/2009/02/27/get-adps1/comment-page-1/#comment-4471</link>
		<dc:creator>Niklas Goude</dc:creator>
		<pubDate>Thu, 19 Aug 2010 20:19:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=491#comment-4471</guid>
		<description>Hi, use the -Filter parameter to specify what you want to filter on; sn, givenName, sAMAccountName etc. (think its default set to cn).
here&#039;s an example:

PS &gt; $user = .\Get-AD.ps1 -Domain powershell.nu -User nigo -Filter sAMAccountName -ToObject
PS &gt; $user


distinguishedName : {CN=Niklas Goude,CN=Users,DC=POWERSHELL,DC=NU}
Path              : LDAP://CN=Niklas Goude,CN=Users,DC=POWERSHELL,DC=NU</description>
		<content:encoded><![CDATA[<p>Hi, use the -Filter parameter to specify what you want to filter on; sn, givenName, sAMAccountName etc. (think its default set to cn).<br />
here&#8217;s an example:</p>
<p>PS &gt; $user = .\Get-AD.ps1 -Domain powershell.nu -User nigo -Filter sAMAccountName -ToObject<br />
PS &gt; $user</p>
<p>distinguishedName : {CN=Niklas Goude,CN=Users,DC=POWERSHELL,DC=NU}<br />
Path              : LDAP://CN=Niklas Goude,CN=Users,DC=POWERSHELL,DC=NU</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reynaldo Bentancur</title>
		<link>http://www.powershell.nu/2009/02/27/get-adps1/comment-page-1/#comment-4438</link>
		<dc:creator>Reynaldo Bentancur</dc:creator>
		<pubDate>Mon, 09 Aug 2010 23:47:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=491#comment-4438</guid>
		<description>Oh sorry, I meant to post this earlier. I was running the script in this fashion.
$User1 = .\Get-AD.ps1 -Domain Domain -User rbentancur -ToObject

That is when I got the error above.</description>
		<content:encoded><![CDATA[<p>Oh sorry, I meant to post this earlier. I was running the script in this fashion.<br />
$User1 = .\Get-AD.ps1 -Domain Domain -User rbentancur -ToObject</p>
<p>That is when I got the error above.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reynaldo Bentancur</title>
		<link>http://www.powershell.nu/2009/02/27/get-adps1/comment-page-1/#comment-4437</link>
		<dc:creator>Reynaldo Bentancur</dc:creator>
		<pubDate>Mon, 09 Aug 2010 23:45:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=491#comment-4437</guid>
		<description>Very interesting read and nice script, but I have a problem running it. 
I get the error 
You cannot call a method on a null-valued expression.
At E:\PowershellScripts\get-ad.ps1:631 char:59
+             $SearchResult = ($Searcher.FindOne()).GetDirectoryEntry &lt;&lt;&lt;&lt; ()
    + CategoryInfo          : InvalidOperation: (GetDirectoryEntry:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Can you give me some help?</description>
		<content:encoded><![CDATA[<p>Very interesting read and nice script, but I have a problem running it.<br />
I get the error<br />
You cannot call a method on a null-valued expression.<br />
At E:\PowershellScripts\get-ad.ps1:631 char:59<br />
+             $SearchResult = ($Searcher.FindOne()).GetDirectoryEntry &lt;&lt;&lt;&lt; ()<br />
    + CategoryInfo          : InvalidOperation: (GetDirectoryEntry:String) [], RuntimeException<br />
    + FullyQualifiedErrorId : InvokeMethodOnNull</p>
<p>Can you give me some help?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

