122 lines
2.8 KiB
C#
122 lines
2.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Management.Automation;
|
|
using System.Management.Automation.Provider;
|
|
using Intel.Management.Mei;
|
|
using Intel.Management.Wsman;
|
|
|
|
namespace Intel.Management.Module
|
|
{
|
|
public class AmtDriveInfo : DriveInfo
|
|
{
|
|
|
|
WsmanConnection _conn;
|
|
//DriveItem _root;
|
|
|
|
|
|
|
|
public AmtDriveInfo(PSDriveInfo driveInfo)
|
|
: base(driveInfo)
|
|
{
|
|
_conn = new WsmanConnection();
|
|
|
|
_conn.Address = "https://ibex7m.intelmas.net:16993/wsman";
|
|
|
|
_conn.Password = "P@ssw0rd";
|
|
_conn.Username = "admin";
|
|
|
|
List<DriveItem> driveList = new List<DriveItem>();
|
|
|
|
//define the admin container
|
|
DriveItem[] adminChildren = { new StorageAdminItem(this) };
|
|
DriveContainer configContainer = new DriveContainer("Config", adminChildren);
|
|
|
|
driveList.Add(configContainer);
|
|
driveList.Add(new StorageItem(this));
|
|
|
|
if (string.Compare(driveInfo.Root,"Admin", true) == 0)
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
else if (string.Compare(driveInfo.Root, "Storage", true) == 0)
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
{
|
|
|
|
}
|
|
|
|
_root = new DriveContainer(string.Empty, driveList.ToArray());
|
|
//if (Root=
|
|
//"https://serverhame:16992/wsman"
|
|
}
|
|
|
|
|
|
/* public DriveItem GetItemFromPath(string path)
|
|
{
|
|
char[] pathChar = { '\\','/' };
|
|
string[] paths = path.Split(pathChar,StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
|
//find item in path
|
|
DriveItem parent = _root;
|
|
DriveItem foundItem = null;
|
|
|
|
if (string.Compare(path, _root.Name, true) == 0)
|
|
{
|
|
foundItem = _root;
|
|
}
|
|
|
|
for (int i = 0; i < paths.Length; i++)
|
|
{
|
|
foundItem = null;
|
|
|
|
// get the parent item before accessing the children
|
|
foreach (DriveItem childItem in parent.GetChildItems(this))
|
|
{
|
|
|
|
if (string.Compare(childItem.Name, paths[i], true) == 0)
|
|
{
|
|
foundItem =childItem;
|
|
parent = foundItem;
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
if (foundItem == null)//path not correct
|
|
{
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
return foundItem;
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public WsmanConnection WsmanConnection
|
|
{
|
|
get
|
|
{
|
|
return _conn;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|