Thankyou sir, that appears to work well indeed

A kick in the right direction would have sufficed, but that’s sorted me nicely 😊

From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On 
Behalf Of Michael B. Smith
Sent: 12 October 2017 21:10
To: ntsysadm@lists.myitforum.com
Subject: [NTSysADM] RE: PowerShell brainfart

This isn’t the fastest (using .NET would be), but it’s easy to understand:

$username = ( gwmi win32_computersystem ).username.ToString()
$sid = ( gwmi win32_useraccount |? { $_.Caption -eq $username } ).SID
gwmi win32_userprofile |? { $_.SID -eq $sid }


From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> 
[mailto:listsad...@lists.myitforum.com] On Behalf Of James Rankin
Sent: Thursday, October 12, 2017 3:45 PM
To: ntsysadm@lists.myitforum.com<mailto:ntsysadm@lists.myitforum.com>
Subject: [NTSysADM] PowerShell brainfart

OK, I’m having a ditzy moment

I’m trying to query profile type in PowerShell using gwmi

Specifically gwmi win32_userprofile | select localpath, status

But this returns all users on the machine – how can I make it return just the 
current user? I’m having a severe blonde moment – help!

(Apologies to all blondes on the list)

Cheers,


[cid:image001.png@01D21FCA.D5DD9850]
[cid:image002.jpg@01D21FCA.D5DD9850]
[cid:image003.jpg@01D343A0.5CEB9E10]






James Rankin CTA ACA vExpert
Technical Evangelist / Media Hound
Howell Technology Group
Office: 0191 4813446
Mobile: 07809 668579
Email: ja...@htguk.com<mailto:ja...@htguk.com>

www.htguk.com<http://www.htguk.com/> | Twitter<https://twitter.com/htguk> | 
Linkedin<https://www.linkedin.com/in/markhtg> | 
Facebook<https://www.facebook.com/HTGUK>


COMPANY INFORMATION
Howell Technology Group Ltd is a limited company registered in England with 
registered number 5520670 and VAT registered number GB 862 666 004. Our 
registered office is at 2.30 One Trinity Green, Eldon Street, South Shields, 
Tyne & Wear, NE33 1SA

CONFIDENTIALITY NOTICE
This message is intended solely for the addressee and may contain confidential 
information. If you have received this message in error, please send it back to 
us, and immediately and permanently delete it. Do not use, copy or disclose the 
information contained in this message or in any attachment.

PRIVACY POLICY
For information about how we process data and monitor communications please see 
our Privacy Policy.

To log a ticket please follow the link. https://htguk.on.spiceworks.com/portal

Reply via email to