Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Shutdown Remote-XP-PC from Win98-Machine

529 views
Skip to first unread message

Christoph Basedau

unread,
Mar 26, 2003, 5:09:12 PM3/26/03
to
Hi

I'd like to Shutdown a WinXP-PC from a Win98-PC.
Both are part of a simple Peer-To-Peer Network
with no Domains, but only one common Workgroup.

I have a simplified WMI-Script that should do the Job.
But it doesn't work to shutdown the remote machine.
Instead I get an error-msg (translated):
"File- or Classname not found during Automation-Operation: GetObject"

The Line is: Set oWMI = GetObject("winmgmts:" & _

But wait, WMI *is* installed on both machines, the Win-98
machine and on the remote XP machine too of course.
And it's installed properly, i believe, at least any local
WMI-Job works correctly on both PCs. I never tried
to do remote jobs so far :-(
The script works on both PCs to shutdown the local PC itself.
But not to shutdown a remote one.
At least there is no error trying to shutdown the W98-PC
from the XP-machine (logged in as admin). Simply nothing
happens then *g*
I guess all of this has got something to do with having
or not having enough privilges/access-rights an so on.

So, is there a way to shutdown and power off a XP-PC
from an Win98 PC? Do I have to create NT-Domains to do so?
Or can I do it with tools instead of WMI?
Or is there a trick to "impersonate" yourself with more
privileges or something like it, in order to solicit a XP
machine to get shutdown by an retarded and old-fashioned
Win98-PC?

Any help appreciated.

mfg + thx,
Christoph


'script, slightly moderated from
'current wsh-newsgroup-snippets

Const EWX_SHUTDOWN = 1
Set oWSNet = CreateObject("WScript.NetWork")
sThisComputer = UCase(oWSNet.ComputerName)

Const sDefComputer = "XP"
Const strTtl = "Remote-Shutdown"

sSelectedComputer = InputBox("Remote PC's name s'il " & _
vous plait!", strTtl, sDefComputer)

If sSelectedComputer = "" Then WScript.Quit
sSelectedComputer = UCase(sSelectedComputer)

If InStr (sSelectedComputer, "\\") = 1 Then _
sSelectedComputer = Mid(sSelectedComputer,3)

If sSelectedComputer = sThisComputer Then
If MsgBox ("Really want to Shutdown THIS PC?",4+32+256, _
strTtl) = 7 then WScript.Quit
end if

'Here's where the touble occurs when trying to shutdown an
'XP-Computer from W98:
Set oWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" _
& sSelectedComputer & "\root\cimv2")

For Each oOS in oWMI.ExecQuery _
("Select * from Win32_OperatingSystem")
oOS.Win32shutdown EWX_SHUTDOWN
Next

Torgeir Bakken (MVP)

unread,
Mar 26, 2003, 5:50:33 PM3/26/03
to
Christoph Basedau wrote:

> I'd like to Shutdown a WinXP-PC from a Win98-PC.
> Both are part of a simple Peer-To-Peer Network
> with no Domains, but only one common Workgroup.
>
> I have a simplified WMI-Script that should do the Job.
> But it doesn't work to shutdown the remote machine.
> Instead I get an error-msg (translated):
> "File- or Classname not found during Automation-Operation: GetObject"
>
> The Line is: Set oWMI = GetObject("winmgmts:" & _
>
> But wait, WMI *is* installed on both machines, the Win-98
> machine and on the remote XP machine too of course.

Hi

WinXP Home or Pro? If Home, I think that will limit what you can do with it
remotely.


Also, it could be a ForceGuest issue (set by a registry value). It means that
all
the connection coming from "the network" will be authenticated as the Guest
User.

For WinXP, the ForceGuest setting is enabled by default when in workgroup mode
(not
domain) and gives access problems for WMI connections and shares access, other
DCOM
services and RPC services as well.

Note that for WinXP Home you cannot disable the ForceGuest behavior (only in
WinXP Pro).


So, on your computer running WinXP Pro, you could try this:

You can change this registry value without using regedit.exe through these
steps

-

1. Open the Local Security Policy console in the Administrative Tools folder.

2. Browse down to: Security Settings\Local Policies\Security Options.

3. Double-click on the Network Access: Sharing And Security Model For Local
Accounts.

4. Change the settings from Guest Only to Classic. This feature is, by default,

set to Classic when Windows XP Professional is joined to a domain.


Using regedit.exe is also possible:

HOWTO: Validate User Credentials on Microsoft Operating Systems
http://support.microsoft.com/default.aspx?scid=KB;EN-US;180548

<quote>
On Windows XP, the ForceGuest registry value is set to 1 by default in the
following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa

On a Windows XP computer that is a member of a workgroup:
If ForceGuest is enabled (set to 1), SSPI will always try to log on using the
Guest account.
If the Guest account is enabled, an SSPI logon will succeed as Guest for any
user credentials.
If the Guest account is disabled, an SSPI logon will fail even for valid
credentials.
If ForceGuest is disabled (set to 0), SSPI will log on as the specified user.
</quote>


More about ForceGuest here as well:

How to Set Security in Windows XP Professional That Is Installed in a Workgroup

http://support.microsoft.com/default.aspx?scid=kb;en-us;290403

SMTP Authentication Configuration on Windows XP Professional Edition
http://support.microsoft.com/default.aspx?scid=kb;en-us;304707

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


Message has been deleted

Torgeir Bakken (MVP)

unread,
Mar 26, 2003, 7:18:28 PM3/26/03
to
Christoph Basedau wrote:

> Hi Torgeir,
>
> Thanx for your great help! i did as described and changed the settings
> to "classic", but it didn't change anything, arghh! its xp pro, btw.
>
> maybe i have to read the other MS-KB-stuff carefully, to find the clue.
> Is it possible that i have to change/assert some settings on the *W98*
> pc too, in order enable *remote* WMI here?
> I installed WMI-Core about 2 years ago and never really did something
> with remote wmi-scripting, iirc, so maybe some reg-settings have to be
> checked here, too.
>
> i wonder because the err-msg appears *immediatly* after starting the script,
> whereas a remote call and failure would take some time (that's just my
> theory).
>
> btw in kb-article you quoted:


> "If ForceGuest is disabled (set to 0), SSPI will log on as the specified user."

> what is the "specified user"? Is it the user on the xp-machine or the user on
> the w98-machine in this situation?
> And is the w98-user allowed to do a shutdown on a xp-machine where an admin is
> logged in?

Hi

I have *very* limited experience with remote WMI, try to ask the WMI experts in the
WMI group:

microsoft.public.win32.programmer.wmi

0 new messages