How to fetch username or userEmail from userprofile details of FSLogix

Hirdesh Baghel 20 Reputation points
2024-10-03T04:04:32.4766667+00:00

Hi

I am trying to fetch several details from FSLogix userprofile like disk size usage , last accessed date. I need to get user details as well like Username or UserEmail.

Below is the PS Snippet that I am using.

 $Profiles = Get-ChildItem -Recurse -Path $FileSharePath -Filter "*.VHDX" -ErrorAction Stop |
    ForEach-Object {
        [PSCustomObject]@{
            UserGPN           = ($_.Name -split '_')[1].Split('.')[0]
            FileShareName     = ($_.FullName -split '\\')[3]
            FileName          = $_.Name
            TotalSizeInGB     = $DriveSizeGB
            ConsumedSizeInGB  = [math]::Round($_.Length / 1GB, 2)
            FilePath          = $_.FullName 
            CreationTimeUtc   = $_.CreationTimeUtc.ToString()
            LastAccessTimeUtc = $_.LastAccessTimeUtc.ToString()
            LastWriteTimeUtc  = $_.LastWriteTimeUtc.ToString()
        }
    }

How can I get that ? Kindly help!

Thanks

Hirdesh

Azure Virtual Desktop
Azure Virtual Desktop
A Microsoft desktop and app virtualization service that runs on Azure. Previously known as Windows Virtual Desktop.
1,572 questions
FSLogix
FSLogix
A set of solutions that enhance, enable, and simplify non-persistent Windows computing environments and may also be used to create more portable computing sessions when using physical devices.
497 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. vipullag-MSFT 26,391 Reputation points
    2024-10-03T05:52:20.7+00:00

    Hello Hirdesh Baghel

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    One way to do is to apply the configuration setting to name the VHDX file accordingly with the user name.
    Ref: https://learn.microsoft.com/en-us/fslogix/reference-configuration-settings?tabs=profiles#vhdnamepattern
    Opening each VHDX file is very resource intensive operation and also can block access to the file. 

    Another option is to query the FSLogix event log on the VM.

    Hope this helps.
    If the suggested response helped you resolve your issue, please 'Accept as answer', so that it can help others in the community looking for help on similar topics.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.