Re: WinMgmnt or LDAP Impersonation

From: Scott Elgram (SElgram_at_verifpoint.com)
Date: 03/30/04


Date: Tue, 30 Mar 2004 08:54:34 -0800

Torgeir,
    Thanks for that, it has sent me in the right direction I think. Perhaps
I should better explain what I am trying to do.

    I have been working the last few days on an intranet asp page that will
display information about any computer in the company. This is mainly for
the purpose of the "Higher Ups" to see what computers are in for repairs,
need repairs, have a history of problems and also to see the speeds and
various other information about the computer. Well, in my ASP page I can
call the fallowing code to retrieve the computers OS;

---------------------------------
<%
sub GetOS(CompName)
strComputer = CompName
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"
& strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from
Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
CompOS = objOperatingSystem.Caption
next
Response.write CompOS
end sub
%>
------------------------------------

    This piece of code works great as long as the "File Security" level in
IIS is set to use windows authentication and the person viewing the page is
an administrator. So when I look at it it looks perfect, just the way I
want it, but when they look at it the OS field is blank. What I was hoping
to accomplish is to some how have IIS to use Administrative rights when
querying the information I want.

-- 
-Scott Elgram
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:OxsAR3fFEHA.4012@TK2MSFTNGP09.phx.gbl...
> Scott Elgram wrote:
>
> > However, with both LDAP and WinMgmts I am
> > unable to find an impersonation syntax for them.
> Hi
>
> You can use the OpenDSObject for LDAP as well:
>
> IADsOpenDSObject::OpenDSObject
>
http://msdn.microsoft.com/library/en-us/adsi/adsi/iadsopendsobject_opendsobject.asp
>
>
> For WMI, you can connect connect with explicit user credentials
> using SWbemLocator.ConnectServer.
>
> IWbemLocator::ConnectServer
>
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/iwbemlocator_connectserver.asp
>
> Subject: Login with explicit username and password
> Newsgroups: microsoft.public.win32.programmer.wmi
> http://groups.google.com/groups?th=2b5bcad76f5debaa
>
> Subject: ImpersoantionLevel other than impersonate
> Newsgroups: microsoft.public.scripting.wsh
> http://groups.google.com/groups?th=89ff50603f12dcfb
>
>
>
> -- 
> 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/community/scriptcenter/default.mspx


Relevant Pages

  • Re: WinMgmnt or LDAP Impersonation
    ... > unable to find an impersonation syntax for them. ... For WMI, you can connect connect with explicit user credentials ... Newsgroups: microsoft.public.win32.programmer.wmi ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.scripting.vbscript)
  • Re: Lost of the Window XP password
    ... Administrator was reset and after that, ... >need to go into your BIOS setup to change the boot device ... >Microsoft MVP Scripting and WMI, ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Registry Editor is Disabled by Administrator
    ... > Editor has been disabled by Administrator. ... For the Spyware and Parasites part, you will need to run other tools: ... The Parasite Fight Quick Fix Protocol ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windowsxp.security_admin)
  • Re: "Run As" command in a script
    ... problem of applications requiring a user to have administrative priveleges. ... we would like to create a script to run these applications as the local administrator on the computer. ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.scripting.wsh)
  • Re: User time logs?
    ... > but I can't find a facility whereby the administrator can ... You will need 3rd party software for this, ... The powerful feature "User Working Time" allows you to limit working ... Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windowsxp.customize)