Re: WinMgmnt or LDAP Impersonation
From: Scott Elgram (SElgram_at_verifpoint.com)
Date: 03/30/04
- Next message: Stan: "RE: Is there a way to pass a parameter to vbs script file?"
- Previous message: R Giskard Reventlov: "why write a script when u can write a vb6 app"
- In reply to: Torgeir Bakken \(MVP\): "Re: WinMgmnt or LDAP Impersonation"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Stan: "RE: Is there a way to pass a parameter to vbs script file?"
- Previous message: R Giskard Reventlov: "why write a script when u can write a vb6 app"
- In reply to: Torgeir Bakken \(MVP\): "Re: WinMgmnt or LDAP Impersonation"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|