computerName from userName on PowerShell
hi,
i have .net app allows teachers remotelly close student's computer session if student not paying attention teacher says. teacher has datagrid students, , can shut the single computer where student logged by selecting student name. that, installed script on every student computer writes username / computername on mysql database.
but i'm looking powershell script without having care installing script on every student computer. , find hard recover computername username....i confess it's first powershell script....what :
get-qadcomputer -searchroot "ourdomainonad/students/computers" -searchscope 'onelevel' | foreach { get-wmiobject -class win32_computersystem -computername $_.name } | { ($_username -eq "studentname" )} | select-object name, username | out-string
results correct script takes very longtime execute , there errors "rpc server not available". after obtaining name of computer selected student logged in still have shutdown computer, it takes time.
do know better way obtain computername given studentname logged in? want recover computername given username logged on computer.
thank much,
susana
susana
1) how can change user , computer account description attributes each time user logs on? (no rec)
2) using logon script
- create share
- map logon script ou
- logon script (echo %username% %computername% %date% %time% > \\server\share\%computername%.txt)
- parse *.txt
Windows Server > Windows PowerShell
Comments
Post a Comment