Uwaga
Dostęp do tej strony wymaga autoryzacji. Może spróbować zalogować się lub zmienić katalogi.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
W Configuration Manager zresetujesz pamięć podręczną spisu sprzętu, łącząc się z przestrzenią nazw agenta spisu i usuwając wystąpienie stanu akcji spisu dla spisu sprzętu.
Aby zresetować pamięć podręczną spisu sprzętu
Połącz się z przestrzenią nazw agenta spisu (root\ccm\invagt).
Usuń wystąpienie stanu akcji spisu dla spisu sprzętu ({00000000-0000-0000-0000-000000000001}).
Przykład
Poniższa przykładowa metoda pokazuje, jak zresetować pamięć podręczną spisu sprzętu, łącząc się z przestrzenią nazw agenta spisu i usuwając wystąpienie stanu akcji spisu dla spisu sprzętu.
Aby uzyskać informacje na temat wywoływania przykładowego kodu, zobacz How to Call a Configuration Manager Object Class Method by Using WMI (Jak wywołać metodę klasy obiektów Configuration Manager przy użyciu usługi WMI)
Sub ResetHardwareInventoryCache()
' Get a connection to the "root\ccm\invagt" namespace.
Dim locator
Set locator = CreateObject("WbemScripting.SWbemLocator")
Dim services
Set services = locator.ConnectServer( , "root\ccm\invagt")
' Delete the specified InventoryActionStatus instance.
services.Delete "InventoryActionStatus.InventoryActionID='{00000000-0000-0000-0000-000000000001}'"
' Display message.
wscript.echo "Reset Hardware Inventory cache."
End Sub
// How to Reset the Hardware Inventory Cache
public void ResetHardwareInventoryCache()
{
try
{
// Define the scope (namespace).
ManagementScope inventoryAgentScope = new ManagementScope(@"root\ccm\invagt");
// Load the class that you want to work with.
ManagementClass inventoryClass = new ManagementClass(inventoryAgentScope.Path.Path, "InventoryActionStatus", null);
// Query the class for the InventoryActionID object (create query, create searcher object, execute query).
ObjectQuery query = new ObjectQuery("SELECT * FROM InventoryActionStatus WHERE InventoryActionID = '{00000000-0000-0000-0000-000000000001}'");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(inventoryAgentScope, query);
ManagementObjectCollection queryResults = searcher.Get();
// Enumerate the collection to get to the result (there should only be one item returned from the query).
foreach (ManagementObject result in queryResults)
{
// Display message and delete the object.
Console.WriteLine("Resetting Hardware Inventory cache.");
result.Delete();
}
}
catch (System.Management.ManagementException ex)
{
Console.WriteLine("Failed to run action. Error: " + ex.Message);
throw;
}
}
Kompilowanie kodu
Ten przykład języka C# wymaga:
Obszary nazw
System.Management
Niezawodne programowanie
Aby uzyskać więcej informacji na temat obsługi błędów, zobacz Informacje o błędach Configuration Manager.
zabezpieczenia .NET Framework
Aby uzyskać więcej informacji na temat zabezpieczania aplikacji Configuration Manager, zobacz Configuration Manager administracja oparta na rolach.
Zobacz też
zestaw Configuration Manager Software Development Kit
Informacje o spisie Configuration Manager