I'm running through a list of 166 machines and so far nearly a dozen seem to have issues running 'shutdown' via a scheduled task that runs as a different user.
Code looks something like this
...
Dim f_iRestartDelaySeconds, f_iRestartDelayMinutes
f_iRestartDelaySeconds = 1800...
Objective: Notify user of system reboot in 30 minutes & 'schedule' reboot via `shutdown -t XX`. If the system is still up 30 minutes later, issue 'shutdown(6)' via: Win32_OperatingSystem
History:
I've got a scheduled task that runs as a different user (call it user X) with elevated privileges...
I had considered that but its not 'elegant'. I didn't want to have a collection of scripts like that floating around.
Sad to know there isn't an option to do this :(
Glad to know there isn't an option to do this :)
Thanks again Geates
strongm - thanks for the reply & link. This is an excellent function indeed.
But something isnt' behaving properly. For future ['scheduled'] deployments, I usually do something like:
'if (Today's Date is > Target Date) Then
if (Now() > "2/13/2013") Then
do whatever
end if
That tends to...
Ready fire aim! - shooting from the hip here.
I'm not entirely sure I understand the process. I'm probably just being dense. Here's a function that returns true/false if the file is empty.
Function FileEmpty(File_Path_Name)
Const s_ForReading=1
Const s_ForWriting=2
Dim s_sFileName...
Just to confirm, after executing the takeown command
wshShell.Run "TAKEOWN /F """ & objUser.profilePath & """ /R /D Y", 0, True
Is your current user ID listed as the owner?
[ol 1]
Check the Properties of the folder
Go to the Security tab
Click Advanced
Click the Owner tab
Are you listed?
[/ol]...
Outside of creating a chromeless window via HTABox, I'm curious to know if there's a way in vbscript to display a pop-up that doesn't stall the entire script. Both msgbox and popup stall the script until either a user intervenes, or, in the case of popup only, the timeout occurs.
You're correct - I missed a step when I was posting that - the CurDT one looks like the way to go.
Function CurDT
Dim s_oWMIService, s_colItems, s_oItem
Dim s_sLocalDateTime, s_iLocalMonth, s_iLocalDay, s_iLocalYear
Dim s_iLocalHour, s_iLocalMinute, s_iLocalSecond
Dim s_MMDDYYYY...
In Short: Why doesn't RemoteShutdown work for a local user on a local workstation? Why must one use Shutdown instead?
While testing a reboot function within a script as a user with local admin rights on the machine in question, I kept getting '-2147217310/80041062 Privilege not held' errors...
Ohh and one more thing, something I touched on before: The script runs at 2AM but we won't necessarily know the state of the machine. We won't know if its locked (not used), unlocked (actively used) or just sitting at the login screen. The script should execute under any of those circumstances.
Happy Monday to you Geates - I hope you had a pleasant weekend.
Thanks also again for the reply.
Hah yeah its not immediate - I wanted to give the user notice *just in case* - there's a 'shutdown -a' script they can execute in an emergency situation. :) I tried to add that as a fail safe in...
Thanks for the response Geates.
As I mentioned before, the user has full local admin rights and more than enough AD rights. As for the 'start' in directory, the script resides in a directory on the local machine which the user has full access to.
I forgot to add two things:
I added a...
I've written a script that runs via a Scheduled Task under a user account that has full local admin privileges on all workstations and sufficient access in AD. When I initially tested the script, I ran it as a normal user account that also had full local admin privileges but very limited AD...
So I spent some time trying to figure out Locales, Regional Settings etc and decided on using just the LocalDateTime property in Win32_OperatingSystem:
Function CurDT
Dim s_oWMIService, s_colItems, s_oItem
Dim s_sLocalDateTime, s_iLocalMonth, s_iLocalDay, s_iLocalYear
Dim s_iLocalHour...
I periodically run into an issue where the date [format] I'm using in my VBScripts (typically MM/DD/YYYY) don't behave as expected on various machines. Upon further inspection it has to do with the local regional settings on said machine.
What's the best method for ensuring that my dates are...
Hi DougInCanady & Welcome to Tek-Tips!
I'm fairly certain I've done this exercise in the past so I'm likely to have some code floating around somewhere but it might take me a while to find it. On the upside, I've found what I believe will work for you via a quick Google search.
Assuming the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.