//
using System . Management;
private void button1_Click( object sender , EventArgs e)
{
ManagementClass vManagementClass =
new ManagementClass ( "root\\CIMV2" , "Win32_Share" , null );
ManagementBaseObject vInputParams =
vManagementClass . GetMethodParameters( "Create" );
vInputParams[ "Name" ] = "Temp" ;
vInputParams[ "Path" ] = @"C:\temp" ;
vInputParams[ "Type" ] = 0 ;
ManagementBaseObject vOutputParams =
vManagementClass . InvokeMethod( "Create" , vInputParams, null );
// TODO :
}
private void button2_Click( object sender , EventArgs e)
{
ManagementObject vManagementObject =
new ManagementObject ( "root\\CIMV2" , "Win32_Share.Name='Temp'" , null );
ManagementBaseObject vOutputParams =
vManagementObject . InvokeMethod( "Delete" , null , null );
// TODO :
}