Jump to content

Script rebooting system?


Recommended Posts

We are trying to install Microsoft File and Printer Sharing on WinXP Pro boxes in a Novell environment. I am a pretty basic AutoIt user, but it has saved the day in the past and I decided to break it out again for this task. The script is simply sending keyboard commands to do the service install, and then a run command at the end to enable the firewall exception.

When I do these tasks manually, it works and does not prompt me for a reboot. However, when I run the .au3 script or compiled .exe, it installs F&PS, but then restarts the computer before it adds the firewall exception. Can't figure out why it would do that. Does anyone have any ideas or a test box to see if it's happening on more than just our machines?

CODE
; Open Network Connections Control Panel applet

Run("control ncpa.cpl")

WinWaitActive("Network Connections")

; Selects Local Area Connection properties

Send("l")

Send("!F")

Send("r")

WinWaitActive("Local Area Connection")

; Install

Send("!n")

WinWaitActive("Select Network Component Type")

; Selects Service, Add

Send("{DOWN}")

Send("!a")

WinWaitActive("Select Network Service")

; Select File and Printer Sharing for Microsoft Networks

Send("{ENTER}")

WinWaitActive("Local Area Connection")

; Close Local Area Connection properties screen and Network Connections window

Send("{TAB 6}")

Send("{ENTER}")

WinClose("Network Connections")

; Enter Firewall exception for File and Printer Sharing

Run(@ComSpec & " /c " & '"netsh firewall set service type = FILEANDPRINT Mode = ENABLE"',@SystemDir,@SW_SHOW)

Link to comment
Share on other sites

Well, we never did figure out why running the AutoIt script would force a reboot, but we did finally find a way to do what we needed without using AutoIt. If you need to :

- To install Client for Microsoft Networks

snetcfg.exe -v -c c -i ms_client

- To install File and Printer Sharing for Microsoft Networks

snetcfg.exe -v -c s -i ms_server

- To enable the File and Printer Sharing exception in Windows Firewall

c:\windows\system32\netsh.exe firewall set service type=fileandprint mode=enable

We found several sites through searching Google that offered the snetcfg.exe file for download. You could potentially use AutoIt to run those commands if you want, but we were using MS Config Mgr 2k7 to send those commands to the workstations and it worked like a charm. I had a heck of a time finding that information online, so hopefully this will help someone else looking for the same thing.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...