Esempio n. 1
0
        internal static string GetCurrentPartitionPath(SessionState sessionState)
        {
            ADRootDSE   rootDSE;
            string      str     = null;
            ADDriveInfo current = sessionState.Drive.Current as ADDriveInfo;

            if (current != null)
            {
                using (ADObjectSearcher aDObjectSearcher = new ADObjectSearcher(current.SessionInfo))
                {
                    rootDSE             = aDObjectSearcher.GetRootDSE();
                    rootDSE.SessionInfo = current.SessionInfo;
                }
                string currentDriveLocation = ProviderUtils.GetCurrentDriveLocation(sessionState, current.SessionInfo);
                if (currentDriveLocation != string.Empty)
                {
                    try
                    {
                        str = ADForestPartitionInfo.ExtractAndValidatePartitionInfo(rootDSE, currentDriveLocation);
                    }
                    catch (ArgumentException argumentException1)
                    {
                        ArgumentException argumentException = argumentException1;
                        object[]          objArray          = new object[1];
                        objArray[0] = currentDriveLocation;
                        throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.ProviderUtilInvalidDrivePath, objArray), argumentException);
                    }
                }
                else
                {
                    return(string.Empty);
                }
            }
            return(str);
        }
Esempio n. 2
0
 protected internal virtual string GetDefaultQueryPath()
 {
     if (!this._cmdletParameters.Contains("Server") && this._pipelineSessionInfo == null && ProviderUtils.IsCurrentDriveAD(base.SessionState))
     {
         string currentDriveLocation = ProviderUtils.GetCurrentDriveLocation(base.SessionState, this.GetSessionInfo());
         if (this.GetSessionInfo().ConnectedToGC || !string.IsNullOrEmpty(currentDriveLocation))
         {
             return(currentDriveLocation);
         }
     }
     return(this.GetDefaultQueryPathBase());
 }