using (SPSite site = new SPSite(siteUrl))
{
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
foreach (UserProfile userProfile in profileManager)
Console.WriteLine(userProfile[PropertyConstants.UserName].Value);
}

![[FIX] BizTalk Server 2010, 2013, 2013 R2 & 2016 errors “Class not registered (WinMgmt)” or “Access denied”](https://i1.wp.com/blogit.create.pt/wp-content/uploads/2018/07/access-black-and-white-blur-270514.jpg?resize=218%2C150&ssl=1)












