Home > OS >  Powershell PS batch problem
Powershell PS batch problem

Time:11-15

The first paragraph
$User=read - host "User name"
$PS=read - host "password"
$IP=read - host "IP address"
$PassWord=ConvertTo - SecureString - String $PS - AsPlainText - Force
$the Credential=New - Object - TypeName "System. Management Automation. PSCredential" - ArgumentList $User and $PassWord
Enter - PSSession $IP - the credential $the credential

The second paragraph
$Server=read - host "service name"
$enalbe=read - host "/block refused to allow permission"
Netsh advfirewall firewall rule name=$Server set new action=$enalbe


Excuse me each great god how to run after the first paragraph, then run the second paragraph, thank you.

CodePudding user response:

Add judgment? The first complete execute the second step is true?
  • Related