Logging collections import
This commit is contained in:
parent
659bf1c990
commit
ddcd9ca2db
2 changed files with 23 additions and 4 deletions
|
@ -343,7 +343,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
private static ResultObject ImportCollectionInternal(int itemId, string collectionName)
|
private static ResultObject ImportCollectionInternal(int itemId, string collectionName)
|
||||||
{
|
{
|
||||||
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "SHADOW_RDS_SESSION");
|
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "IMPORT_RDS_COLLECTION");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -1702,6 +1702,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Log.WriteStart(string.Format("Starting collection import: {0}", collection.Name));
|
||||||
runSpace = OpenRunspace();
|
runSpace = OpenRunspace();
|
||||||
var orgPath = GetOrganizationPath(organizationId);
|
var orgPath = GetOrganizationPath(organizationId);
|
||||||
CheckOrCreateAdGroup(GetComputerGroupPath(organizationId, collection.Name), orgPath, GetComputersGroupName(collection.Name), RdsCollectionComputersGroupDescription);
|
CheckOrCreateAdGroup(GetComputerGroupPath(organizationId, collection.Name), orgPath, GetComputersGroupName(collection.Name), RdsCollectionComputersGroupDescription);
|
||||||
|
@ -1742,7 +1743,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
MoveSessionHostToCollectionOU(rdsServer.Name, collection.Name, organizationId);
|
MoveSessionHostToCollectionOU(rdsServer.Name, collection.Name, organizationId);
|
||||||
AddAdGroupToLocalAdmins(runSpace, rdsServer.FqdName, helpDeskGroupSamAccountName);
|
AddAdGroupToLocalAdmins(runSpace, rdsServer.FqdName, helpDeskGroupSamAccountName);
|
||||||
AddAdGroupToLocalAdmins(runSpace, rdsServer.FqdName, localAdminsGroupSamAccountName);
|
AddAdGroupToLocalAdmins(runSpace, rdsServer.FqdName, localAdminsGroupSamAccountName);
|
||||||
|
|
||||||
|
Log.WriteStart(string.Format("Adding server {0} to AD Group, OrgId: {1}", rdsServer.Name, organizationId));
|
||||||
AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer);
|
AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer);
|
||||||
|
Log.WriteStart(string.Format("Server {0} added to AD Group, OrgId: {1}", rdsServer.Name, organizationId));
|
||||||
}
|
}
|
||||||
|
|
||||||
string collectionComputersPath = GetComputerGroupPath(organizationId, collection.Name);
|
string collectionComputersPath = GetComputerGroupPath(organizationId, collection.Name);
|
||||||
|
@ -1753,6 +1757,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
CreateHelpDeskPolicy(runSpace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), new DirectoryEntry(collectionComputersPath), organizationId, collection.Name);
|
CreateHelpDeskPolicy(runSpace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), new DirectoryEntry(collectionComputersPath), organizationId, collection.Name);
|
||||||
|
|
||||||
SetUsersInCollection(organizationId, collection.Name, users);
|
SetUsersInCollection(organizationId, collection.Name, users);
|
||||||
|
|
||||||
|
Log.WriteStart(string.Format("Collection imported: {0}", collection.Name));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -1852,20 +1858,33 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
var computerGroupName = GetComputersGroupName( collectionName);
|
var computerGroupName = GetComputersGroupName( collectionName);
|
||||||
var computerObject = GetComputerObject(server.Name);
|
var computerObject = GetComputerObject(server.Name);
|
||||||
|
|
||||||
|
Log.WriteStart(string.Format("ComputerGroupName: {0}\r\nServerName: {1}\r\nCollectionName: {2}", computerGroupName, server.Name, collectionName));
|
||||||
|
|
||||||
if (computerObject != null)
|
if (computerObject != null)
|
||||||
{
|
{
|
||||||
var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(computerObject, "sAMAccountName");
|
var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(computerObject, "sAMAccountName");
|
||||||
|
Log.WriteStart(string.Format("sAMAccountName: {0}\r\nPath: {1}\r\n", samName, computerObject.Path));
|
||||||
|
|
||||||
if (!ActiveDirectoryUtils.IsComputerInGroup(samName, computerGroupName))
|
if (!ActiveDirectoryUtils.IsComputerInGroup(samName, computerGroupName))
|
||||||
{
|
{
|
||||||
ActiveDirectoryUtils.AddObjectToGroup(computerObject.Path, GetComputerGroupPath(organizationId, collectionName));
|
string groupPath = GetComputerGroupPath(organizationId, collectionName);
|
||||||
|
Log.WriteStart(string.Format("ComputerGroupPath: {0}", groupPath));
|
||||||
|
ActiveDirectoryUtils.AddObjectToGroup(computerObject.Path, groupPath);
|
||||||
|
Log.WriteStart(string.Format("{0} added to {1}", computerObject.Path, groupPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ActiveDirectoryUtils.IsComputerInGroup(samName, RDSHelpDeskComputerGroup))
|
if (!ActiveDirectoryUtils.IsComputerInGroup(samName, RDSHelpDeskComputerGroup))
|
||||||
{
|
{
|
||||||
ActiveDirectoryUtils.AddObjectToGroup(computerObject.Path, GetHelpDeskGroupPath(RDSHelpDeskComputerGroup));
|
string helpDeskGroupPath = GetHelpDeskGroupPath(RDSHelpDeskComputerGroup);
|
||||||
|
Log.WriteStart(string.Format("HelpDeskGroupPath: {0}", helpDeskGroupPath));
|
||||||
|
ActiveDirectoryUtils.AddObjectToGroup(computerObject.Path, helpDeskGroupPath);
|
||||||
|
Log.WriteStart(string.Format("{0} added to {1}", computerObject.Path, helpDeskGroupPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.WriteStart(string.Format("ComputerObject IS NULL"));
|
||||||
|
}
|
||||||
|
|
||||||
SetRDServerNewConnectionAllowed(false, server);
|
SetRDServerNewConnectionAllowed(false, server);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue