malcolm29
asked on
PowerShell ActiveDirectory Module in Windows 8.1 without installing RSAT
I am writing a PS script which I want to run locally on a number of computers (not remotely). One of the commands in the script is Get-ADComputer, which is found in the ActiveDirectory module. This module is automatically installed when you install the Remote Server Administration Tools, but I don't want to have to do that on all the computers on which I want to run the script.
Is there any way to import the ActiveDirectory module on Windows 8.1 computers without installing RSAT on the computers?
Thanks.
Is there any way to import the ActiveDirectory module on Windows 8.1 computers without installing RSAT on the computers?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think that's fine. In fact, the query via adsi should be faster than using the AD cmdlet.
One note - although it works, using Select-String as you have isn't really correct. Better usage is to use the -match operator.
One note - although it works, using Select-String as you have isn't really correct. Better usage is to use the -match operator.
if ($sString -match "OU=Public Computers")
ASKER
footech, thanks so much for the -match operator! I agree that it's a better solution! Thanks again!!!
ASKER
$sString = ((([ADSISearcher]"(&(Objec
if (Select-String -Pattern "OU=Public Computers" -InputObject $sString) #Search for whether this computer is in the OU called "Public Computers"
{
Write-Output "Found it"
}
else
{
Write-Output "NOT Found it"
}