Re: VBscript that restart the domain comptuer

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

If your goal is simply to delete local profiles, I have an easier solution.

Here is a batch file that if you put as a scheduled task will delete all
profiles not in use. Even if the profile is in use it will delete everything
but the user.dat unless you specify it in the "excludes"

<start batch file>
@echo off
pushd "C:\Documents and Settings"

set Exempt=*Administrator* *All Users* *Default User* *LocalService*
*NetworkService* *MyProfile1* *MyProfile2*
for /d %%a in (*.*) do echo %Exempt% | find /i "*%%a*" > nul || rmdir /s /q
"%%a"
popd
<end batch file>


"madal" wrote:

Hello Richard.

Thanks for your detail informaion on the subjected matter. What I am trying
to do is : I have a small R&D lab were quite a lot people logs in to it. I do
not maintain romaing profile so everytime user logs on it creats local users
profile in c:\document setting\username. I have already VB script I deployed
via GPO in shutdown script and that does the delete all those pofile. But
what I would like to do is write some vbscript that will restart the machine
let say at midnight and on the same time delete those profiles. Basically
with the script vbscript or bat restart the machine once a day (midnight) and
when it re-starting should apply the shutdown script that will delete those
users profile.

Madal

romaing profile .com> wrote in message
news:2E458F2D-48E9-4577-ABA0-0B4E59B13EE0@xxxxxxxxxxxxxxxx
I would like to restart domain computer once a day and like to deploy
script
via GPO. Would it be possible ? also at the time it restarts i would like
to
call another vbscript that deletes some files in computer.

Can someone point out how to achieve this ?


With a GPO you can deploy logon, logoff, startup, and shutdown scripts. The
shutdown script, for example, runs during shutdown. It does not initiate
shutdown. I don't see how a GPO script would meet your needs. Logon and
logoff scripts run with the credentials of the user, who probably does not
have permission to restart or delete files.

A VBScript program using WMI can shutdown or restart a computer remotely.
For example:

http://www.microsoft.com/technet/scriptcenter/guide/sas_cpm_gmen.mspx

Perhaps you could restart the computers remotely. You could read computer
names from a text file. WMI can also be used in a VBScript program to
remotely delete files. For example:

http://www.microsoft.com/technet/scriptcenter/guide/sas_fil_vudw.mspx

You need a query for the specific files you want to delete. Browse more of
"Microsoft Windows 2000 Scripting Guide" for more on using WMI queries to
delete files meeting your conditions:

http://www.microsoft.com/technet/scriptcenter/guide/sas_fil_ciaj.mspx

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--



.



Relevant Pages

  • Re: VBscript that restart the domain comptuer
    ... deleting local profile with your scripts does the trick. ... via GPO in shutdown script and that does the delete all those pofile. ... what I would like to do is write some vbscript that will restart the machine ...
    (microsoft.public.windows.server.active_directory)
  • Re: VBscript that restart the domain comptuer
    ... Even if the profile is in use it will delete everything ... via GPO in shutdown script and that does the delete all those pofile. ... what I would like to do is write some vbscript that will restart the machine ...
    (microsoft.public.windows.server.active_directory)
  • Re: More before-the-fact advice for 2K and XP?
    ... long-term with a profile without execute granted, ... we can consider changing these in a login script. ... if you can script the permissions change in a login ... >> You're interested in using NTFS file ACLs and GP ACL templates to ...
    (microsoft.public.security)
  • Re: Modify Profile paths and user directory in mass.
    ... Windows Server MVP - Directory Services ... user account has a home directory or a server based profile, ... doing some kind of script based query which returns and then edits ... changetype: add ...
    (microsoft.public.windows.server.active_directory)
  • Re: Open to suggestions
    ... My intention is to have a script that will query the AD profile attribute ... Perhaps you can pass credentials to an ADO connection ... ' Construct the ADO query, ...
    (microsoft.public.scripting.vbscript)