UserWorkstations attribute field empty using Powershell despite user having userWorkstations attributes

Farid Ngah 20 Reputation points
2023-09-08T08:05:26.9766667+00:00

I'm using this powershell script to retrieve userWorkstations attribute :-

Get-ADUser -Identity 'AccountABCD' -properties * | Select Name, sAMAccountName, userWorkstations

However, only Name and sAMAccountName appearing despite user having userWorkstations attributes.

Any workaround on this ?

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Limitless Technology 44,751 Reputation points
    2023-09-08T15:07:40.7066667+00:00

    Hello

    Thank you for your question and reaching out.

    Please try below three different powershell commands to get list of User's workstations.

    1. Get-Aduser -filter {LogonWorkstations -like "*"} -Properties LogonWorkstations
    2. Get-Aduser -filter * -Properties LogonWorkstations

    Import-Module ActiveDirectory

    $complist = Import-Csv -Path "c:\temp\myworkstationList.csv" | ForEach-Object {$_.NetBIOSName}

    foreach($comp in $complist){

    $comparray += $comp

    }

    Set-ADUser -Identity username -LogonWorkstations $comparray

    Reference:

    https://learn.microsoft.com/en-us/answers/questions/597823/logonworkstions-userworkstation-attribute-is-empty

    --If the reply is helpful, please Upvote and Accept as answer--

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Farid Ngah 20 Reputation points
    2023-09-11T07:15:56.49+00:00

    I've tried the above steps. However, the workstation field still empty.

    0 comments No comments

  2. Farid Ngah 20 Reputation points
    2023-09-14T08:23:08.8366667+00:00

    Issue fixed once I executed the PS script at my local pc using administrator account.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.