troubleshooting Question

Syncing AD computer description with local computer description

Avatar of BFanguy
BFanguyFlag for United States of America asked on
PowershellOperating SystemsActive DirectoryPC
4 Comments1 Solution47 ViewsLast Modified:
The following is running as a logon script in Group Policy.  

$path = "C:\Windows\System32\WindowsPowerShell\v1.0\Modules\ActiveDirectory"
#Check to see if ActiveDirectory Module already is installed
if (!(Test-Path $path)){
#Importing the Get-ADComputer function from ActiveDirectory Module 
Import-Module \\\sysvol\\scripts\Spiceworks\ActiveDirectory\ActiveDirectory.psd1
$switch = $True
#Setting the local computer name to a variable
$ADCompName = $env:computername
#Querying Active Directory for the Description of the computer name matching the local computer
$ADDesc = Get-ADComputer -Identity "$ADCompName" -Property Description| Select-Object -ExpandProperty Description
#Grabbing the OS object for access to local PC properties
$CompDesc = Get-WmiObject -Class Win32_OperatingSystem -ComputerName "$ADCompName"
#Setting the local PC description to the current AD description
$CompDesc.Description = "$ADDesc"
#Doing the changes

Open in new window

When this script launches on some machines (not all) I get this error.
Error.pngThis is the directory which clearly has the correct dlls in it.
Directory.pngI cannot figure out how I should place these dlls in order for this script to read it.
Michael B. Smith
Managing Consultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros