This is the first of my series about SharePoint Managed Account, this feature is newly introduced in SharePoint 2010. SharePoint Managed Account feature now enable us to easily manage the User accounts by means of password changing and notification for password change and automatic password reset.
And also used for Configuring and mapping different accounts with different services and Web Applications. Without registering the account, we can’t create a Service application and Web Applications.
In this post I am giving the snippet for retrieving the list of registered managed account users from the Farm.
SPFarm farm = SPFarm.Local;
SPFarmManagedAccountCollection accounts = new SPFarmManagedAccountCollection(farm);
foreach (SPManagedAccount account in accounts)
{
Console.Write(account.Username);
}
SPFarmManagedAccountCollection returns the available managed accounts from the given farm.
SPManagedAccount has the list of properties of the registered account. By using those properties we can set the password reset schedule, etc..
Here I am just displaying only Username property of the Registered Account.
Coming posts I’ll come up with an interesting stuff with Managed Accounts, Stay tune my blog…
November 15, 2015 at 4:26 AM
Good Morning,I’m trying the scrpit to backup a site collection with notification.I have notice that, if a file name in the destination path already exist, the scrpit send an email that all is ok, but in reality the backup wasn’t done, and receive the following error on powershell windows:Backup-SPSite : File C:BCKSITE7-08-2012test.bak already exists. Use the parameter -Force to overwrite an existing backup.At C:BCK Site.ps1:17 char:16+ Backup-SPSite <<<< -Identity $Site -Path C:BCKSITE$todaytest.bak + CategoryInfo : InvalidData: (Microsoft.Share mdletBackupSite:SPCmdletBackupSite) [Backup-SPSite], SPE xception + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletBackupSiteSorry for my english.thanks to allGiuliano