Pull NT user ID from powershell
问题 get-wmiobject -class win32_computersystem -computername c73118 | format-table username Will output something similar to: username -------- GHS_NTDOMAIN\amacor Is it possible to only output the amacor part only? 回答1: first, you don't really want FT for this I don't think. Use Select -Expand instead. So doing that we get back the string GHS_NTDOMAIN\amacor . Once you have that, you can do .Split("\") to split it into an array of strings, and [-1] to specify the last string in the array. So it