Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Question
- Sign in to vote
- 0
- Sign in to vote
- # Get sharing configuration;
- $INTERFACE_ID = "{DDA95938-9816-421D-A2C6-36A83DEF6273}";
- Write-Output "INTF ID $INTERFACE_ID ";
- # Create a NetSharingManager object
- $MY_NetShare = New-Object -ComObject HNetCfg.HNetShare;
- if($MY_NetShare.SharingInstalled){
- if($Con = $MY_NetShare.EnumEveryConnection | ? { $MY_NetShare.NetConnectionProps.Invoke($_).Guid -eq $INTERFACE_ID }){
- $Sharing_Config = $MY_NetShare.INetSharingConfigurationForINetConnection.Invoke($Con);
- if($Sharing_Config.SharingEnabled){
- $Sharing_Config.DisableSharing()
- }else{
- Write-Host 'not enabled'
- }
- }else{
- Write-Host 'no connections'
- }
- }else{
- Write-Host 'not installed'
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement