public void PollVirtueCommandControl(System.ComponentModel.BackgroundWorker worker, System.ComponentModel.DoWorkEventArgs e) { handler.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; remoteAppSkeleton = GetPowershellSkeleton(); //WriteLog("Impersonated the virtue domain administrator account."); //string psscript = @"New-RDSessionCollection -PersonalUnmanaged -CollectionName ""mosertestIE"" -SessionHost ""EC2AMAZ-986SD7H.virtue.local"" -ConnectionBroker ""EC2AMAZ-O3KO101.virtue.local"""; //runPS(psscript); //psscript = @"Add-RDSessionHost -CollectionName ""mosertestIE"" -SessionHost ""EC2AMAZ-986SD7H.virtue.local"""; //runPS(psscript); //psscript = @"Set-RDPersonalSessionDesktopAssignment -CollectionName ""mosertestIE"" -ConnectionBroker ""EC2AMAZ-O3KO101.virtue.local"" -User ""virtue.local\kamoser"" -Name ""EC2AMAZ-986SD7H.virtue.local"""; //runPS(psscript); //psscript = @"New-RDRemoteApp -CollectionName ""mosertestIE"" -DisplayName ""InternetExplorer"" -FilePath ""c:/wmp/wmplayer.exe"" -UserGroups ""virtue.local\kamoser"""; //runPS(psscript); //WriteLog("Ending impersonation of the virtue domain administrator account."); while (true) { VirtueConfigurationEvent logonEvent = queue.Take(); PollCommandControl(); } }
public void Enqueue(VirtueConfigurationEvent evt) { if (evt.ConfigurationEvent == VirtueConfigurationEvent.VirtueEvent.POLL) { if (queue.Count == 0) { WriteLog("Adding POLL request to event queue." + Environment.NewLine); queue.Add(evt); } } else { queue.Add(evt); WriteLog("Adding " + evt.ConfigurationEvent.ToString() + " request to event queue." + Environment.NewLine); } }