Re: VBscript that restart the domain comptuer
- From: lforbes <lforbes@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 27 Dec 2008 23:44:01 -0800
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
--
- References:
- VBscript that restart the domain comptuer
- From: madal
- Re: VBscript that restart the domain comptuer
- From: Richard Mueller [MVP]
- Re: VBscript that restart the domain comptuer
- From: madal
- VBscript that restart the domain comptuer
- Prev by Date: Make Adam Users look like AD users to email server
- Next by Date: SUPRISE...!
- Previous by thread: Re: VBscript that restart the domain comptuer
- Next by thread: Re: VBscript that restart the domain comptuer
- Index(es):
Relevant Pages
|