
私は PsExec を使用してネットワーク上の Windows 7 コンピューターの cmd にアクセスしており、立ち上がってFile and Printer Sharing
コンピューターまで歩かずに をオンにしてから、Windows ファイアウォールをオンにしたいと考えています。
これを行うにはどのようなコマンドを使用する必要がありますか?
ありがとう
答え1
このコマンドはファイルとプリンタの共有を処理する必要があります。
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
ファイアウォールの場合:
netsh advfirewall set currentprofile state on
今試してみましたが、私には効果があるようです。
追加情報については、Microsoft の KB 記事を参照してください。http://support.microsoft.com/kb/947709
答え2
プライベート プロファイルに対してのみファイルとプリンターの共有を有効にするには、次のコマンドを使用します。
netsh firewall set service type=fileandprint mode=enable profile=standard
Windows 8 または Windows Server 2012 以降の OS の場合は、他のコマンドを使用できます。
wmic /namespace:\\Root\StandardCimv2 path MSFT_NetFirewallRule where (RuleGroup="@FirewallAPI.dll,-28502" and Profiles=2) call enable
答え3
コマンドを使用してnet start
サービスを開始できます。例:
net start "Windows Firewall"
ただし、私の限られた調査では、ファイルとプリンターの共有は、CLI で名前で呼び出せるサービスではありません。ただし、Windows ファイアウォールは可能です。
答え4
netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in new enable=Yes
こちらをご覧ください: https://serverfault.com/a/739272/83850