none
Script for editing users “log on to” property RRS feed

  • Question

  • Hello

    I need a script to allow user1 to log on only to pc1 and pc2

    I can do this in active directory by this path: users>username>properties>account>log on to>Pcs names

    Thank you.


    • Moved by Bill_Stewart Monday, May 7, 2018 9:58 PM This is not "scripts on demand"
    Thursday, March 1, 2018 6:49 AM

All replies

  • Hi,

    If you're using Active Directory you could just use logon restrictions on the user object in Active Directory itself.

    Thursday, March 1, 2018 7:27 AM
  • Thank you for reply.

    I want to assign a group of 15 PCs to some users. It take times to do this Manually. Because in Active Directory user "log on to" properties we should add PCs one by one.

    Thursday, March 1, 2018 8:38 AM
  • What have you come up with so far?

    We're happy to help to find and fix bugs in your script but we won't write something for you from scratch.

    Have a look at Set-ADUser and the attribute LogonWorkstations

    Thursday, March 1, 2018 8:47 AM
  • Thank You.
    Thursday, March 1, 2018 10:30 AM
  • You can use the -LogonWorkstations parameter of the Set-ADUser cmdlet to assign values to the userWorkstations attribute of the user object. Assign the NetBIOS name or the DNSHostName of the computers in a comma delimited string. For example (from the help for Set-ADUser):

    -LogonWorkstations "saraDavisDesktop,saraDavisLapTop,projectA.corp.contoso.com"


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Thursday, March 1, 2018 12:50 PM
  • Set-ADUser -Identity $username -LogonWorkstations $computername(s)

    • Edited by mcrazz Friday, March 2, 2018 5:45 PM
    Friday, March 2, 2018 5:44 PM