Need to manipulate ICS from command line batch script, but did not found suitable console tool. But found powershell script which do such task. The problem is the script is multiline and as I have zero experiences with PS, looking for someone who could create few oneliners from such script to easily run trhough batch script and parse its output. Need following oneliners:
Anyone could help me with this?
Why on Earth would they need to be one-liners? None of these are suitable for one-liners, for instance your first one could look like this.
(New-Object -ComObject HNetCfg.HNetShare -OutVariable netshare).EnumEveryConnection | foreach {[PSCustomObject]@{Interface = $netshare.NetConnectionProps.Invoke($_).name; ICSEnabled = $netshare.INetSharingConfigurationForINetConnection.invoke($_).sharingenabled}}