graybags Posted February 7, 2020 Author Share Posted February 7, 2020 Didn't have a chance to try again yesterday, but i've run the script, rebooted and no - still can't map it's c drive. if I tick the box, I can map it. Link to comment Share on other sites More sharing options...
Subz Posted February 7, 2020 Share Posted February 7, 2020 You could just use PowerShell to enable/disiable (check/uncheck) File and Printer Sharing for Microsoft Networks #RequireAdmin _FilePrintSharing("Ethernet", True) Func _FilePrintSharing($_sAdapterName = "Ethernet", $_bEnable = True) Switch $_bEnable Case False ;~ Disable File and Printer Sharing for Microsoft Networks RunWait('PowerShell -Command "& {Disable-NetAdapterBinding -Name ' & "'" & $_sAdapterName & "' -DisplayName 'File and Printer Sharing for Microsoft Networks'" & '}"', "", @SW_HIDE) Case True ;~ Enable File and Printer Sharing for Microsoft Networks RunWait('PowerShell -Command "& {Enable-NetAdapterBinding -Name ' & "'" & $_sAdapterName & "' -DisplayName 'File and Printer Sharing for Microsoft Networks'" & '}"', "", @SW_HIDE) EndSwitch EndFunc Link to comment Share on other sites More sharing options...
graybags Posted February 7, 2020 Author Share Posted February 7, 2020 Wow, that actually worked - excellent, thank you. I noticed that's for Ethernet, how could I adapt it to work for all adaptors? Would an * work? Link to comment Share on other sites More sharing options...
Subz Posted February 7, 2020 Share Posted February 7, 2020 You can use something like to enable/disable File and Printer Sharing for Microsoft Networks for all network adapters. #RequireAdmin _FilePrintSharing() Func _FilePrintSharing($_bEnable = True) Switch $_bEnable Case False ;~ Disable File and Printer Sharing for Microsoft Networks RunWait('PowerShell -Command "& {Get-NetAdapter | Disable-NetAdapterBinding -DisplayName ' & "'File and Printer Sharing for Microsoft Networks'" & '}"', "", @SW_HIDE) Case True ;~ Enable File and Printer Sharing for Microsoft Networks RunWait('PowerShell -Command "& {Get-NetAdapter | Enable-NetAdapterBinding -DisplayName ' & "'File and Printer Sharing for Microsoft Networks'" & '}"', "", @SW_HIDE) EndSwitch EndFunc AdamUL 1 Link to comment Share on other sites More sharing options...
graybags Posted February 8, 2020 Author Share Posted February 8, 2020 Thanks again, I've been pulling my hair out over the last few days over this. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now