The following script works for PowerShell 4 but I need to figure out its equivalent for systems with PowerShell 2. The purpose of the script is to enable the File and Print Sharing for Microsoft Networks across all network adapters on a system.
$adapters = Get-NetAdapter
Foreach($adapter_name in $adapters) {
Enable-NetAdapterBinding -name $adapter_name.name -ComponentID ms_server
}
I found PowerShell 2 code for the first part to get the adapter names but not the second part that enables the feature.
$adapters = Get-WmiObject Win32_NetworkAdapter | Select-Object -ExpandProperty NetConnectionID