Home All Groups Group Topic Archive Search About

Shutdown script doesn't do anything



Author
17 Apr 2007 4:29 PM
greenbeer77
I have a Windows 2k3 Active Directory in native mode and Win2k and XP
clients.  I have written a vb script that will detect a drive mapping
to U: and if it is there, replace it with a new mapping or add the
drive mapping if one does not exist.  I tested the script and it works
if I run it when I'm logged into windows as a user with very little
network access.  When I try to run it as a shutdown script, it does
show that a shutdown script is running, but when I log in again, my
old drive mapping is still there.  I've been testing by mapping the
drive incorrectly and rebooting.  The Group Policy is applying, but
the desired result is not being met.

Any thoughts?

Author
17 Apr 2007 5:25 PM
Richard Mueller [MVP]
<greenbee***@gmail.com> wrote in message
Show quote
news:1176827377.174010.153970@o5g2000hsb.googlegroups.com...
>I have a Windows 2k3 Active Directory in native mode and Win2k and XP
> clients.  I have written a vb script that will detect a drive mapping
> to U: and if it is there, replace it with a new mapping or add the
> drive mapping if one does not exist.  I tested the script and it works
> if I run it when I'm logged into windows as a user with very little
> network access.  When I try to run it as a shutdown script, it does
> show that a shutdown script is running, but when I log in again, my
> old drive mapping is still there.  I've been testing by mapping the
> drive incorrectly and rebooting.  The Group Policy is applying, but
> the desired result is not being met.
>
> Any thoughts?
>

When a Shutdown (or Startup) script runs, there is no user. I don't see how
a drive mapping could apply, since the mapping is for the current user. I
would do this in a logon script. There are parameters to deal with
persistent connections (remove them). In VBScript I use code similar to:

objNetwork.RemoveNetworkDrive "U:", True, True

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
Author
17 Apr 2007 6:03 PM
greenbeer77
On Apr 17, 12:25 pm, "Richard Mueller [MVP]" <rlmueller-
nos...@ameritech.nospam.net> wrote:
Show quote
> <greenbee***@gmail.com> wrote in message
>
> news:1176827377.174010.153970@o5g2000hsb.googlegroups.com...
>
> >I have a Windows 2k3 Active Directory in native mode and Win2k and XP
> > clients.  I have written a vb script that will detect a drive mapping
> > to U: and if it is there, replace it with a new mapping or add the
> > drive mapping if one does not exist.  I tested the script and it works
> > if I run it when I'm logged into windows as a user with very little
> > network access.  When I try to run it as a shutdown script, it does
> > show that a shutdown script is running, but when I log in again, my
> > old drive mapping is still there.  I've been testing by mapping the
> > drive incorrectly and rebooting.  The Group Policy is applying, but
> > the desired result is not being met.
>
> > Any thoughts?
>
> When a Shutdown (or Startup) script runs, there is no user. I don't see how
> a drive mapping could apply, since the mapping is for the current user. I
> would do this in a logon script. There are parameters to deal with
> persistent connections (remove them). In VBScript I use code similar to:
>
> objNetwork.RemoveNetworkDrive "U:", True, True
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab -http://www.rlmueller.net
> -

Ok, that's what I was thinking, but I wasn't sure.
Author
17 Apr 2007 8:38 PM
greenbeer77
On Apr 17, 12:25 pm, "Richard Mueller [MVP]" <rlmueller-
nos...@ameritech.nospam.net> wrote:
Show quote
> <greenbee***@gmail.com> wrote in message
>
> news:1176827377.174010.153970@o5g2000hsb.googlegroups.com...
>
> >I have a Windows 2k3 Active Directory in native mode and Win2k and XP
> > clients.  I have written a vb script that will detect a drive mapping
> > to U: and if it is there, replace it with a new mapping or add the
> > drive mapping if one does not exist.  I tested the script and it works
> > if I run it when I'm logged into windows as a user with very little
> > network access.  When I try to run it as a shutdown script, it does
> > show that a shutdown script is running, but when I log in again, my
> > old drive mapping is still there.  I've been testing by mapping the
> > drive incorrectly and rebooting.  The Group Policy is applying, but
> > the desired result is not being met.
>
> > Any thoughts?
>
> When a Shutdown (or Startup) script runs, there is no user. I don't see how
> a drive mapping could apply, since the mapping is for the current user. I
> would do this in a logon script. There are parameters to deal with
> persistent connections (remove them). In VBScript I use code similar to:
>
> objNetwork.RemoveNetworkDrive "U:", True, True
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab -http://www.rlmueller.net
> --

I am trying to go in a different direction with this script.
Ultimately, I am trying to get rid of McAfee and install Trend.  It's
a WAN environment and Trend doesn't have much for deployment over a
wan.  So, I'm trying to do it using Group Policy.  I've tried using an
MSI package and deploying that using the software installation section
under computer settings. That attempt just put the MSI file in add
remove programs on all the pc's, without actually installing Trend or
removing McAfee.  So, now I have written a script that will just call
trend.exe, which is the setup program, and I'd like to use it as a
shutdown script.

I tested it out on a Win2k pro client and when I shut down, it said
that the shutdown script was running, then it went to shutting down
the computer right away.  When it started back up, McAfee was still
there and Trend was not.  I have tested the trend.exe from inside
Windows and it runs just fine as long as I am in windows.

Here is the script:

Option Explicit
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "c:\trend.exe"
WScript.Quit

I looked in Event Viewer and there is nothing in there about the
shutdown script.
Author
18 Apr 2007 7:09 PM
Richard Mueller [MVP]
Show quote
> I am trying to go in a different direction with this script.
> Ultimately, I am trying to get rid of McAfee and install Trend.  It's
> a WAN environment and Trend doesn't have much for deployment over a
> wan.  So, I'm trying to do it using Group Policy.  I've tried using an
> MSI package and deploying that using the software installation section
> under computer settings. That attempt just put the MSI file in add
> remove programs on all the pc's, without actually installing Trend or
> removing McAfee.  So, now I have written a script that will just call
> trend.exe, which is the setup program, and I'd like to use it as a
> shutdown script.
>
> I tested it out on a Win2k pro client and when I shut down, it said
> that the shutdown script was running, then it went to shutting down
> the computer right away.  When it started back up, McAfee was still
> there and Trend was not.  I have tested the trend.exe from inside
> Windows and it runs just fine as long as I am in windows.
>
> Here is the script:
>
> Option Explicit
> Dim objShell
> Set objShell = CreateObject("WScript.Shell")
> objShell.Run "c:\trend.exe"
> WScript.Quit
>
> I looked in Event Viewer and there is nothing in there about the
> shutdown script.
>

I have had success remotely installing some applications using WMI, although
it took awhile to figure out all the details. Of course, you must have
administrator privileges on all the computers, but a member of Domain Admins
should by default be a member of the local Administrators group on every
computer joined to the domain. I have a VBScript program to deploy
patches/updates/applications linked here:

http://www.rlmueller.net/Deploy.htm

This program deploys to all computers in a group. The executable deployed
must be able to run unattended. Another option is SMS.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--

AddThis Social Bookmark Button