Constantine Posted December 18, 2007 Posted December 18, 2007 I need to make a batch file run on every computer in our organization. The catch is, I need to do this multiple times a quater and want to be able to do it remotely. The file is located in our netlogon directory so everyone can see it. All the file does is reference another batch file that actually executes the application.I tried creating a job and just copying it to the remote pc's tasks folder. That failed. The file copies but it effectively loses the username I give it and takes on my username once copied. Once I give it a different username is works, the issue is, I don't want to have to remote into every machine and change the user name.Any suggestions, ideas, or thoughts?I already use a logon script but getting nurses to reboot/relog a machine in a hospital is impossible.If there is something along the lines of PCexec that actually works I'm definately open to that idea as well.
Constantine Posted December 18, 2007 Author Posted December 18, 2007 Tried it before I posted this, but just tried it again. I may just not be Intelligent enough to use it.I tried:at \\computername 15:00 \\Computername\Netlogon\SCRIPT.BATIt copies across, acts, disapears like it ran, and nothing happens.
Mordac85 Posted December 19, 2007 Posted December 19, 2007 Personally, I'd use schtasks.exe instead of AT b/c, imho, it's a more robust alternative. I don't know what kind of environment you have, but you may want to consider either: Adding a routine to run said app every x days to their logon script (maybe a tag file on their system w/last run date or an unused field in AD) Using a GPO
Constantine Posted December 19, 2007 Author Posted December 19, 2007 I just tried using schtasks.exe. The error I recieved said the scheduled task has been created, but may not run because the account information could not be set. This is basically the answer I am encountering.The program is BGInfo (for those who don't know it's a program that edits a background to put information on the screen such as Hostname/IP). Right now, it is referenced by a batch file that excutes it the way I want it to execute. I've tried using all sorts of alternatives to get it to work and nothing worked but this. I basically just need a way to make this program update when I tell it to on each computer in our Domain. If you know of a GPO that might help me do this I'm completely open to suggestions.Adding a routine to run said app every x days to their logon script (maybe a tag file on their system w/last run date or an unused field in AD)This does give me an idea though. Is there a way to make their login script rerun itself without actually logging in? Could I add a line in the script that says to run this every x days, or run on specific days? Or even better yet, just make the batch file for my BGInfo run every so many days?
Mordac85 Posted December 19, 2007 Posted December 19, 2007 Unfortunately, you need a user logged in to have BGinfo update the wallpaper. But there are a number of alternatives if you're running into issues with a scheduled task on all systems, which is not a preferable solution.You can use a simple text file, stored anywhere, an unused field in the AD computer object that just has a line for the date your update was last run or the date the BGinfo template file was last modified. Then just check the text file or AD field for its value. If it's say > 90 days or the template has been modified, re-run the script. * OR *Why not just have your script query AD for all computer objects, skip the ones where AD attribute operatingSystem contains "server", then use psexec to run the BGinfo update on the system remotely. This way you can make whatever changes you want and just kick off the script to push the update and you have a single point to manage the process.
Constantine Posted December 19, 2007 Author Posted December 19, 2007 I actually used an excel macro to get a pc list to use with the @file setting for PCExec. The issue with PCexec was I could not get it to edit the background. It would run the script but nothing would happen. I even tried getting it to just flat out run bginfo.exe. That still would not do anything.I'd love to use PCexec, that was actually the first thing I tried.
Mordac85 Posted December 19, 2007 Posted December 19, 2007 Forgot you'd have to load their profile and run under the user's credentials to get it to change the wallpaper. Maybe the logon script is the easier route, checking for the template modify timestamp or run at each logon no matter what. That way it would be pretty much hands off, and all you would need to do is just maintain the BGinfo template.
eyeball Posted December 19, 2007 Posted December 19, 2007 if you are using bginfo run it with the /timer:0 command to update the details displayed hope this helps
nmX.Memnoch Posted December 19, 2007 Posted December 19, 2007 A logon script is definitely the easier route. Do you have one already?
Constantine Posted December 19, 2007 Author Posted December 19, 2007 Yeah. I already have it implemented using a logon script w/ Timer:0.My issue is. I am IT in a Hospital, if you don't know what thats like. It basically means my users might log off their PC's once every 2 months, even then, it's only because their PC blue screens and forces them to reboot. So what I need is 1 of 2 things.Either a way to Actively cause each computer to do this. For instance if It is possible to use active directory to tell an entire group of computers to execute their logon script, or another pre-defined script at a specific time or on a specific day.A way to force BGInfo without using a logon script and instead using a group script.Ideally. I would like to be able to place this into part of a GPO as a run once command. Once each computer gets updated with this GPO's settings they would run the command that inniates the script one time.
eyeball Posted December 19, 2007 Posted December 19, 2007 (edited) now you explain it all it makes a lot more sense why you want to do it that way. I think a scheduled task would definatly be the best way to go.i have just setup a test XP and test SBS server and this is the command i ran from the server and it worked (i copied and pasted this from my command prompt)C:\Documents and Settings\Administrator>schtasks /create /S testxp /RU sbsdom\administrator /RP P@55w0rd /SC HOURLY /TN TestTask /TR c:\windows\system32\mspaint.exeSUCCESS: The scheduled task "TestTask" has successfully been created.C:\Documents and Settings\Administrator>obviously that runs Mspaint.exe every hour but you get the idea Edited December 19, 2007 by eyeball
Mordac85 Posted December 20, 2007 Posted December 20, 2007 What account do you need to use to run this to update the logged in user's wallpaper tho? I haven't gotten into playing w/tasks to this extent before, but since it's altering the wallpaper for the user I would assume you need to run the task in that context, which would mean setting up the task w/their user/pass and then again when/if they change their passwords. Or would a domain service account be able to do this? A bit of a quandry since you can't reliably fall back to a logon script either. Maybe a GPO would be a better route, but again, will the context play a part in how it operates?
Constantine Posted December 20, 2007 Author Posted December 20, 2007 The way Task Scheduler should work. It will run the task that you tell it to as the current user, but with the credentials you supply. It would be the same thing as shift+right click and using Run As.My question for you Eyeball. I can create the tasks. The issue is it always says task failed to start. That's what confuses me. Mabey it has something to do with the fact that I'm creating a task to run a batch file. I'll have to look into that.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now