File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ import subprocess
2
+ import argparse
3
+
4
+ parser = argparse .ArgumentParser (description = "Troubleshoot Network errors" )
5
+ group = parser .add_mutually_exclusive_group ()
6
+ group .add_argument ('-i' , '--ipreset' , type = bool , help = "Reset TCP/IP configs" )
7
+ group .add_argument ('-s' , '--sockreset' , type = bool , help = "Fix socket errors" )
8
+ parser .add_argument ('-r' , '--restart' , action = 'store_true' )
9
+ args = parser .parse_args ()
10
+
11
+
12
+ def resetIp ():
13
+ subprocess .run ('netsh int ip reset' )
14
+
15
+
16
+ def socketFix ():
17
+ subprocess .run ('netsh winsock reset' )
18
+
19
+
20
+ def restart ():
21
+ subprocess .run (["shutdown" , "-r" ])
22
+
23
+
24
+ if __name__ == '__main__' :
25
+ if args .ipreset :
26
+ resetIp ()
27
+ elif args .sockreset :
28
+ socketFix ()
29
+ if args .restart :
30
+ restart ()
You can’t perform that action at this time.
0 commit comments