tl;dr PowerShell / (Set|Get)-NetAdapterBinding / PnPUtil / nvspbind を使用して、ドライバー / アダプター バインディング / アダプター サービスを自動化しようとしています
私は、Windows Server 2012 および 2012 R2 のネットワーク アダプターへのダミーネットドライバーのインストールの自動化を検討してきました。
これらの手順を自動化する必要があります。
Pull up the properties for the Network Adapter that is used to access the Internet
Click "Install"
Select "Service" and click "Add"
Click "Have Disk" and navigate to webpagetest\dummynet
Select the ipfw+dummynet service (and click through any warnings about the driver being unsigned)
PnPUtilユーティリティを使用して、ドライバーの INF ファイルをドライバー ストアに追加できると思います。
(Set|Get)-NetAdapterBinding powershell モジュールを調査しましたが、ドライバーを正しく登録できないようです。
これは、手動でインストールした後の Get-NetAdapterBinding の結果です。
PS C:\Users\Administrator> Get-NetAdapterBinding public0 -DisplayName ipfw+dummynet | format-list
Caption : MSFT_NetAdapterBindingSettingData 'Citrix PV Network Adapter #0'
Description : ipfw+dummynet
ElementName : unipi_ipfw
InstanceID : {906E5591-5C6C-4D07-BB8D-BA387BA4B646}::unipi_ipfw
InterfaceDescription : Citrix PV Network Adapter #0
Name : public0
Source : 1
SystemName : ComputerName
BindName : Ipfw
Characteristics : 17424
ComponentClassGuid : {4D36E974-E325-11CE-BFC1-08002BE10318}
ComponentClassName : Filter
ComponentID : unipi_ipfw
DisplayName : ipfw+dummynet
Enabled : True
PSComputerName :
ifAlias : public0
InterfaceAlias : public0
ifDesc : Citrix PV Network Adapter #0
Get-NetAdapterBinding -Name public -DisplayName ipfw+dummynet | GM
TypeName: Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2
/MSFT_NetAdapterBindingSettingData
Name MemberType Definition
---- ---------- ----------
ifAlias AliasProperty ifAlias = Name
ifDesc AliasProperty ifDesc = InterfaceDescription
InterfaceAlias AliasProperty InterfaceAlias = Name
Clone Method System.Object ICloneable.Clone()
Dispose Method void Dispose(), void IDisposable.Dis...
Equals Method bool Equals(System.Object obj)
GetCimSessionComputerName Method string GetCimSessionComputerName()
GetCimSessionInstanceId Method guid GetCimSessionInstanceId()
GetHashCode Method int GetHashCode()
GetObjectData Method void GetObjectData(System.Runtime.Se...
GetType Method type GetType()
ToString Method string ToString()
BindName Property string BindName {get;}
Caption Property string Caption {get;set;}
Characteristics Property uint32 Characteristics {get;}
ComponentClassGuid Property string ComponentClassGuid {get;}
ComponentClassName Property string ComponentClassName {get;}
ComponentID Property string ComponentID {get;}
Description Property string Description {get;set;}
DisplayName Property string DisplayName {get;}
ElementName Property string ElementName {get;set;}
Enabled Property bool Enabled {get;set;}
InstanceID Property string InstanceID {get;set;}
InterfaceDescription Property string InterfaceDescription {get;}
Name Property string Name {get;}
PSComputerName Property string PSComputerName {get;}
Source Property uint32 Source {get;}
SystemName Property string SystemName {get;}
そのモジュールについて文書化された引数を使用して Set-NetAdapterBinding を試みたのは次のとおりです。
Set-NetAdapterBinding -Name public0 -Component unipi_ipfw -Enabled $True
Set-NetAdapterBinding : No matching MSFT_NetAdapterBindingSettingData objects
found by CIM query for instances of the
ROOT/StandardCimv2/MSFT_NetAdapterBindingSettingData class on the CIM server:
SELECT * FROM MSFT_NetAdapterBindingSettingData WHERE ((Name LIKE 'public0'))
AND ((ComponentID LIKE 'unipi[_]ipfw')). Verify query parameters and retry.
At line:1 char:1
+ Set-NetAdapterBinding -Name public0 -Component unipi_ipfw -Enabled $True
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (MSFT_NetAdapterBindingSettingDa
ta:String) [Set-NetAdapterBinding], CimJobException
+ FullyQualifiedErrorId : CmdletizationQuery_NotFound,Set-NetAdapterBindin
g
これを行う最善の方法を見つけようとして、nvspbindユーティリティにも出会い、このツールを使用してドライバーを追加しようとしました。残念ながら、それをアダプターにバインドすることもできないようです。ユーティリティは、その使用情報を吐き出し続けます。
PowerShell を使用してこの問題にアプローチする最善の方法は何ですか?