This message was deleted.
# _general
s
This message was deleted.
m
VDI or RDS? If VDI (e.g. no chance of concurrent logoffs), you can just do a quick query for last logged on user.
j
RDSH sadly
How do you query for last-logged-on user though, incidentally? That might graft.....not expecting a massive throughput of users on this staging instance
s
I think you need to enable Security Audit to get this details in event log
j
I think I might just write a local folder with the user's name in it as they log out
πŸ‘ 1
s
Easy way πŸ‘Œ - Local Folder can be Cache Drive of PVS πŸ˜‰
j
I just need it for a few minutes in order to migrate their profile, so a local folder or Registry value looks like it might do it
s
πŸ‘
Are u planning to migrate profiles to VHDX ?
j
Migrating Ivanti profiles to FSLogix
s
Okay
l
You can grab the event log xml as an object and extract it from there? Happy to take a look this afternoon mate.
j
That might be awesome, yeah.....got another problem now though, frx.exe command always seems to fail when run as a Scheduled Task but runs fine when an admin user invokes it from a logged-on session.
l
Any particular error or anything captured?
j
Suspect an error 2 is coming up judging by the Scheduler logs
l
Will sit down this afternoon and do the event log bit. Will come back to you.
j
Bizarrely it just worked now. Seems VERY hit and miss. Event log stuff would be awesome for making it slicker mate, would mean I could stop it running at every user logoff and just target the users I know need to be migrated πŸ‘
πŸ‘ 2
j
ControlUp? We have a trigger for event items. We have all the other arguments as well
j
Good point, but people probably wouldn't buy just for migrating some users......although it would be a handy "in", I agree
j
At a minimum it would prove that it's possible πŸ™‚ But yeah, for a one-off maybe not the best way, but as a partner/consultant you could possibly buy a license and make it part of your practice. Or use it as a way to showcase what else ControlUp can do... but that might be the "Sales" in "Sales Engineer" talking
πŸ‘ 1
l
$eventDetails = Get-WinEvent -FilterHashTable @{Logname='security';ID=4634}| Sort -Descending TimeCreated | Select-Object -first 1 -Property TimeCreated,MachineName, @{Name='AccountSID';Expression={$_.Properties[0].Value}}, @{Name='AccountName';Expression={$_.Properties[1].Value}} $eventDetails.AccountName
j
Cheers fella, will give that a try when I get clear of lunch creation
l
Scans the security log for tevent ID 4634, select the latest 1 based on datetime and picks out the details from the properties. Should give you the user details you need. Needs testing to see how long it takes to run on a busy machine,
πŸ‘ 1
Stuff like this always feeds into other projects and ideas so its all worth it.
k
It looks almost like what I am doing with AppLocker event filtering at the moment πŸ˜„
l
Great minds πŸ˜‰
πŸ‘ 1
Slight Amend $eventDetails = Get-WinEvent -FilterHashTable @{Logname='security';ID=4634} -MaxEvents 2 | Sort -Descending TimeCreated |Β Select-Object -first 1 -Property TimeCreated,MachineName, @{Name='AccountSID';Expression={$_.Properties[0].Value}}, @{Name='AccountName';Expression={$_.Properties[1].Value}} $eventDetails.AccountName
Speeds it up, just needs testing to make sure you always get the latest events on logoff. Pretty sure the behaviour is to do new to old.
πŸ‘ 1
be back online later.
j
Well I solved the frx issue - well sort of - my solution is......run it twice
l
If it works reliably we call that a solution ;-)
j
Does it fail the first time because the session isn't completely logged logoff? Just a timing thing?