Change Computer Description

Welcome Forums General PowerShell Q&A Change Computer Description

Viewing 6 reply threads
  • Author
    Posts
    • #254984
      Participant
      Topics: 5
      Replies: 17
      Points: 66
      Rank: Member

      Hi All

      Been digging about to find a script to change an Computer Object Description from a TXT file.

      Would be looking at Having column A as the Computer name and Column B as the description

      Im guessing Get-ADObject would get the description but not sure how to change (Very New to powershell)

      Thanks

      Dan

    • #254990
      Participant
      Topics: 7
      Replies: 2458
      Points: 6,439
      Helping Hand
      Rank: Community MVP

      You should keep searching. There are thousands of examples for tasks like this available even here on Powershell.org.

      The get an AD computer object you can use Get-ADComputer and to set an AD computer object you can use Set-ADComputer. I assume your TXT file is actually a CSV file. So you can use Import-CSV to read the content. Then you use a loop either with foreach or Foreach-Object to glue everything together. 😉

      Please, always read the complete help including the examples for the cmdlets you’re about to use to learn how to use them. Another great source for scripts or modules is the PowershelLGallery or StackOverflow. You can learn how to code in Powershell when you analyze the code others share with the world.

    • #255002
      Participant
      Topics: 0
      Replies: 44
      Points: 427
      Team MemberHelping Hand
      Rank: Contributor

      For the record, there is nothing that needs moderation in Olaf’s reply – which was helpful, and strewn with links to further reading.

      They correctly suggest that OP might:
      – Import the text file using Import-CSV
      – Loop through each record using foreach or ForEach-Object
      – Use Set-ADComputer (which has a Description parameter) to modify the descriptions

      If there are still issues, post the code here and folk will be able to help.

    • #255008
      Participant
      Topics: 5
      Replies: 17
      Points: 66
      Rank: Member

      Hi This is the code below

      CSV format is

      Name, Description

    • #255011
      Participant
      Topics: 5
      Replies: 17
      Points: 66
      Rank: Member

       

       

       

      `

    • #255029
      Participant
      Topics: 7
      Replies: 2458
      Points: 6,439
      Helping Hand
      Rank: Community MVP

      Did you actually read my answer? Get-Content -> Import-CSV !!! And you actually don’t need Get-ADComputer when your CSV file contains the correct name of the computer account.

    • #255245
      Participant
      Topics: 5
      Replies: 17
      Points: 66
      Rank: Member

       

       

      Got it working through this way thanks for the help

Viewing 6 reply threads
  • You must be logged in to reply to this topic.