Re: [ActiveDir] Vista WMI

2006-10-19 Thread Mark Parris
I will have to remember that damn r I'm the future.

Thanks,

Q
Regards,

Mark Parris

Base IT Ltd
Active Directory Consultancy
Tel +44(0)7801 690596


-Original Message-
From: Alain Lissoir [EMAIL PROTECTED]
Date: Thu, 19 Oct 2006 05:29:48 
To:ActiveDir@mail.activedir.org
Subject: RE: [ActiveDir] Vista  WMI

The caption is not corrupted. The branding introduces a (R) and a (TM). 
First, under Vista, the Win32_OperatingSystem class is a singleton class now, 
meaning that you can locate the UNIQUE instance of that as follows: 
  
Set colOperatingSystems = objWMIService.Get (Win32_OperatingSystem=@) 
  
It didn't make sense to enumerate this class when there is actuall only 1 
instance of the class available. However you can continue to enumerate as 
before so, your script does not break on before Vista platforms. 
  
Next to test the Windows version, and not get your script breaking downlevel, 
you should use the following coding technique: 
  
If Instr (objOperatingSystem.Caption, Vista)  0 Then 
  If objOperatingSystem.OperatingSystemSKU = 3 Then 
    WScript.Echo Home Basic Premium Edition 
    wscript.quit 
  End If 
End If 
  
To test the operating SKU (Home, Ultimate, Basic, etc), you should use 
OperatingSystemSKU property. 
  
If you are pure Vista (and Longhorn server) and just need to determine the SKU 
of the OS: 
  
 
Set colOperatingSystems = objWMIService.Get (Win32_OperatingSystem=@) 
Select Case objOperatingSystem.OperatingSystemSKU 
  Case 0 
  WScript.Echo Undefined
  Case 1 
  WScript.Echo Ultimate Edition
  Case 2 
  WScript.Echo Home Basic Edition
  Case 3 
  WScript.Echo Home Basic Premium Edition
  Case 4 
  WScript.Echo Enterprise Edition
  Case 5 
  WScript.Echo Home Basic N Edition 
. 
. 
. 
  
  
HTH 
/Alain 
  
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_operatingsystem.asp:
 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_operatingsystem.asp
 
  
 OperatingSystemSKU 
Data type: uint32
 
 
Stock Keeping Unit (SKU) number for the operating system. Windows Server 2003, 
Windows XP, Windows 2000, and Windows NT 4.0:  This property is not available. 

 
Possible SKU values are:
 
 Value Meaning 
 0 Undefined 
 1 Ultimate Edition 
 2 Home Basic Edition 
 3 Home Basic Premium Edition 
 4 Enterprise Edition 
 5 Home Basic N Edition 
 6 Business Edition 
 7 Standard Server Edition 
 8 Datacenter Server Edition 
 9 Small Business Server Edition 
 10 Enterprise Server Edition 
 11 Starter Edition 
 12 Datacenter Server Core Edition 
 13 Standard Server Core Edition 
 14 Enterprise Server Core Edition 
 15 Enterprise Server IA64 Edition 
 16 Business N Edition 
 17 Web Server Edition 
 18 Cluster Server Edition 
 19 Home Server Edition 
 20 Storage Express Server Edition 
 21 Storage Standard Server Edition 
 22 Storage Workgroup Server Edition 
 23 Storage Enterprise Server Edition 
 24 Server For Small Business Edition 
 25 Small Business Server Premium Edition
 
 

 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, Devon
Sent: Thursday, October 19, 2006 2:56 AM
To: ActiveDir@mail.activedir.org
Subject: [ActiveDir] Vista  WMI

 
 
 
I’m trying to get a script working in Vista with no success.  For some reason 
the OS caption on Vista looks corrupted, but when I enter it as it’s displayed 
in wmic, my script ignores it.  I even tried to correct it, and still no 
success.  Here’s the script:
 
 
 
Dim WshShell
 
strComputer = .
 
Set WshShell = WScript.CreateObject(WScript.Shell)
 
On Error Resume Next
 
 
 
' If Workstation, exit script
 
Dim objWMIService, colOperatingSystems, objOperatingSystem, strComputer, objFSO
 
Set objWMIService = GetObject(winmgmts:  
{impersonationLevel=impersonate}!\\  strComputer  \root\cimv2)
 
Set colOperatingSystems = objWMIService.ExecQuery (Select * from 
Win32_OperatingSystem)
 
For Each objOperatingSystem in colOperatingSystems
 
If objOperatingSystem.Caption = Microsoft Windows 2000 Professional then 
wscript.quit 
 
If objOperatingSystem.Caption = Microsoft Windows XP Professional then 
wscript.quit 
 
If objOperatingSystem.Caption = Microsoftr Windows VistaT Ultimate then 
wscript.quit
 
If objOperatingSystem.Caption = Microsoft Windows Vista Ultimate then 
wscript.quit  
 
Next
 
 
 
' Check / Set registry settings for screen saver.  Logoff user if settings are 
updated
 
Dim isLocked, ssTimeout, ssActive, ScrnSave, wmi, objSet 
 
 
 
isLocked = WshShell.RegRead (HKCU\Control Panel\Desktop\ScreenSaverIsSecure)
 
ssTimeout = WshShell.RegRead (HKCU\Control Panel\Desktop\ScreenSaveTimeout)
 
ssActive = WshShell.RegRead (HKCU\Control Panel\Desktop\ScreenSaveActive)
 
ScrnSave = WshShell.RegRead (HKCU\Control Panel\Desktop\SCRNSAVE.EXE)
 
 
 
If (isLocked = 0) or (CInt(ssTimeout) 900

RE: [ActiveDir] Vista WMI

2006-10-19 Thread Almeida Pinto, Jorge de



joe,

if you are talking about the "operatingSystem" attribute in 
AD, wellit depends

Using the 
latest available builds here...

if OS="Longhorn" and serverRole="writable DC"and 
media="Full Install" then "operatingSystem" attribute DOES NOT contain special 
characters
if 
OS="Longhorn" and serverRole="read-only DC"and media="Full 
Install"then "operatingSystem" attribute DOES NOT contain special 
characters
if OS="Longhorn" and serverRole="member server"  and 
media="Server Core" then "operatingSystem" attribute DOES contain special 
characters
if 
OS="Longhorn" and serverRole="member server" and media="Full Install" then 
"operatingSystem" attribute DOES contain special 
characters
if OS="Vista 
Ultimate" then "operatingSystem" attribute DOES contain special 
characters

Just bugged it again with 
MS

jorge

  
  
  From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  joeSent: Thursday, October 19, 2006 01:05To: 
  ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] Vista  
  WMI
  
  This "corruption" is probably the fact that MSFT[1] put a 
  copyright symbol in the name of the OS, it is even reflected in AD. I bugged 
  this some time ago and got back a "you need to go talk to someone else" 
  initially and then ~Eric tried to push it forward, I don't think it got fixed 
  for Vista. Hopefully they will fix it for Longhorn because there will be quite 
  a few people bitching who are doing things at the command line or like you 
  with scripts.
  
   joe
  
  
  [1] 
  That was said with a sneer and pretend I also said, "ITIW"
  
  --
  O'Reilly Active Directory Third Edition - http://www.joeware.net/win/ad3e.htm
  
  
  
  
  From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of Harding, 
  DevonSent: Wednesday, October 18, 2006 5:26 PMTo: 
  ActiveDir@mail.activedir.orgSubject: [ActiveDir] Vista  
  WMI
  
  
  Im trying to get a script working 
  in Vista with no success. For some 
  reason the OS caption on Vista looks 
  corrupted, but when I enter it as its displayed in wmic, my script ignores 
  it. I even tried to correct it, and still no success. Heres the 
  script:
  
  Dim 
  WshShell
  strComputer = 
  "."
  Set WshShell = 
  WScript.CreateObject("WScript.Shell")
  On Error Resume 
  Next
  
  ' If Workstation, exit 
  script
  Dim objWMIService, 
  colOperatingSystems, objOperatingSystem, strComputer, 
  objFSO
  Set objWMIService = 
  GetObject("winmgmts:"  "{impersonationLevel=impersonate}!\\"  
  strComputer  "\root\cimv2")
  Set colOperatingSystems = 
  objWMIService.ExecQuery ("Select * from 
  Win32_OperatingSystem")
  For Each objOperatingSystem in 
  colOperatingSystems
  If objOperatingSystem.Caption = 
  "Microsoft Windows 2000 Professional" then wscript.quit 
  
  If objOperatingSystem.Caption = 
  "Microsoft Windows XP Professional" then wscript.quit 
  
  If objOperatingSystem.Caption = 
  "Microsoftr Windows VistaT Ultimate" then 
  wscript.quit
  If objOperatingSystem.Caption = 
  "Microsoft Windows Vista Ultimate" then wscript.quit 
  
  Next
  
  ' Check / Set registry settings 
  for screen saver. Logoff user if settings are 
  updated
  Dim isLocked, ssTimeout, ssActive, 
  ScrnSave, wmi, objSet 
  
  isLocked = WshShell.RegRead 
  ("HKCU\Control 
Panel\Desktop\ScreenSaverIsSecure")
  ssTimeout = WshShell.RegRead 
  ("HKCU\Control Panel\Desktop\ScreenSaveTimeout")
  ssActive = WshShell.RegRead 
  ("HKCU\Control Panel\Desktop\ScreenSaveActive")
  ScrnSave = WshShell.RegRead 
  ("HKCU\Control Panel\Desktop\SCRNSAVE.EXE")
  
  If (isLocked = 0) or 
  (CInt(ssTimeout) 900) Or (ssActive = 0) Or (ScrnSave = "") 
  Then
   
  WshShell.RegWrite "HKCU\Control 
  Panel\Desktop\ScreenSaverIsSecure",1,"REG_SZ"
   
  WshShell.RegWrite "HKCU\Control 
  Panel\Desktop\ScreenSaveActive",1,"REG_SZ"
   
  WshShell.RegWrite "HKCU\Control 
  Panel\Desktop\ScreenSaveTimeout",900,"REG_SZ"
   
  WshShell.RegWrite "HKCU\Control Panel\Desktop\SCRNSAVE.EXE","%system 
  root%\system32\logon.scr","REG_SZ"
   WshShell.Popup 
  "ScreenSaver settings were not previously set. Settings have been 
  updated. A logout is required to activate new settings. Click Ok 
  and the system will logout you out now. Auto-logoff in 20 seconds.", 20, 
  , 0 + 64 
   
  WshShell.Run LogonServer  "\netlogon\shutdown.exe /l 
  /f",0,true
  End 
  If--- 
  This message (including any attachments) is intended only for the use 
  of t

RE: [ActiveDir] Vista WMI

2006-10-19 Thread Harding, Devon








This worked fine! 



Thanks!











From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Akomolafe, Deji
Sent: Wednesday, October 18, 2006
6:54 PM
To: ActiveDir@mail.activedir.org
Subject: RE: [ActiveDir] Vista
 WMI









How about you just do
instr(objOperatingSystem.Caption, Vista)
 0 Then wscript.quit











There is something quirky with the caption in Vista. They even misspelled Microsoft :)


















Sincerely, 

_

 (, / |
/)
/) /) 
 /---| (/_ __ ___// _
// _ 
) / |_/(__(_) // (_(_)(/_(_(_/(__(/_
(_/
/) 

(/ 
Microsoft MVP - Directory Services
www.akomolafe.com- we know IT
-5.75, -3.23
Do you now realize that Today is the Tomorrow you were worried about Yesterday?
-anon

















From: Harding, Devon
Sent: Wed 10/18/2006 2:26 PM
To: ActiveDir@mail.activedir.org
Subject: [ActiveDir] Vista 
WMI





Im trying to get a script working in Vista with no success. For some reason the OS
caption on Vista looks corrupted, but when I
enter it as its displayed in wmic, my script ignores it. I even
tried to correct it, and still no success. Heres the script:



Dim WshShell

strComputer = .

Set WshShell =
WScript.CreateObject(WScript.Shell)

On Error Resume Next



' If Workstation, exit script

Dim objWMIService, colOperatingSystems, objOperatingSystem,
strComputer, objFSO

Set objWMIService = GetObject(winmgmts: 
{impersonationLevel=impersonate}!\\  strComputer 
\root\cimv2)

Set colOperatingSystems = objWMIService.ExecQuery
(Select * from Win32_OperatingSystem)

For Each objOperatingSystem in colOperatingSystems

If objOperatingSystem.Caption = Microsoft Windows 2000
Professional then wscript.quit 

If objOperatingSystem.Caption = Microsoft Windows XP
Professional then wscript.quit 

If objOperatingSystem.Caption = Microsoftr Windows VistaT
Ultimate then wscript.quit

If objOperatingSystem.Caption = Microsoft Windows
Vista Ultimate then wscript.quit 

Next



' Check / Set registry settings for screen saver.
Logoff user if settings are updated

Dim isLocked, ssTimeout, ssActive, ScrnSave, wmi, objSet 



isLocked = WshShell.RegRead (HKCU\Control
Panel\Desktop\ScreenSaverIsSecure)

ssTimeout = WshShell.RegRead (HKCU\Control
Panel\Desktop\ScreenSaveTimeout)

ssActive = WshShell.RegRead (HKCU\Control
Panel\Desktop\ScreenSaveActive)

ScrnSave = WshShell.RegRead (HKCU\Control
Panel\Desktop\SCRNSAVE.EXE)



If (isLocked = 0) or (CInt(ssTimeout) 900) Or (ssActive
= 0) Or (ScrnSave = ) Then

 WshShell.RegWrite HKCU\Control
Panel\Desktop\ScreenSaverIsSecure,1,REG_SZ


WshShell.RegWrite HKCU\Control
Panel\Desktop\ScreenSaveActive,1,REG_SZ


WshShell.RegWrite HKCU\Control
Panel\Desktop\ScreenSaveTimeout,900,REG_SZ


WshShell.RegWrite HKCU\Control Panel\Desktop\SCRNSAVE.EXE,%system
root%\system32\logon.scr,REG_SZ

 WshShell.Popup ScreenSaver settings
were not previously set. Settings have been updated. A logout is
required to activate new settings. Click Ok and the system will logout
you out now. Auto-logoff in 20 seconds., 20, , 0 +
64 


WshShell.Run LogonServer  \netlogon\shutdown.exe /l
/f,0,true

End If

---

This message (including any attachments) is
intended only for the use of the individual or entity to which it is addressed
and may contain information that is non-public, proprietary, privileged,
confidential, and exempt from disclosure under applicable law or may constitute
as attorney work product. If you are not the intended recipient, you are hereby
notified that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this communication
in error, notify us immediately by telephone and (i) destroy this message if a
facsimile or (ii) delete this message immediately if this is an electronic
communication. 
Thank you. 





---

This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this message
immediately if this is an electronic communication.

Thank you.




RE: [ActiveDir] Vista WMI

2006-10-18 Thread joe



This "corruption" is probably the fact that MSFT[1] put a 
copyright symbol in the name of the OS, it is even reflected in AD. I bugged 
this some time ago and got back a "you need to go talk to someone else" 
initially and then ~Eric tried to push it forward, I don't think it got fixed 
for Vista. Hopefully they will fix it for Longhorn because there will be quite a 
few people bitching who are doing things at the command line or like you with 
scripts.

 
joe


[1] 
That was said with a sneer and pretend I also said, "ITIW"

--
O'Reilly Active Directory Third Edition - http://www.joeware.net/win/ad3e.htm




From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Harding, 
DevonSent: Wednesday, October 18, 2006 5:26 PMTo: 
ActiveDir@mail.activedir.orgSubject: [ActiveDir] Vista  
WMI


Im trying to get a script working 
in Vista with no success. For some reason 
the OS caption on Vista looks corrupted, but 
when I enter it as its displayed in wmic, my script ignores it. I even 
tried to correct it, and still no success. Heres the 
script:

Dim 
WshShell
strComputer = 
"."
Set WshShell = 
WScript.CreateObject("WScript.Shell")
On Error Resume 
Next

' If Workstation, exit 
script
Dim objWMIService, 
colOperatingSystems, objOperatingSystem, strComputer, 
objFSO
Set objWMIService = 
GetObject("winmgmts:"  "{impersonationLevel=impersonate}!\\"  
strComputer  "\root\cimv2")
Set colOperatingSystems = 
objWMIService.ExecQuery ("Select * from 
Win32_OperatingSystem")
For Each objOperatingSystem in 
colOperatingSystems
If objOperatingSystem.Caption = 
"Microsoft Windows 2000 Professional" then wscript.quit 

If objOperatingSystem.Caption = 
"Microsoft Windows XP Professional" then wscript.quit 

If objOperatingSystem.Caption = 
"Microsoftr Windows VistaT Ultimate" then 
wscript.quit
If objOperatingSystem.Caption = 
"Microsoft Windows Vista Ultimate" then wscript.quit 

Next

' Check / Set registry settings for 
screen saver. Logoff user if settings are 
updated
Dim isLocked, ssTimeout, ssActive, 
ScrnSave, wmi, objSet 

isLocked = WshShell.RegRead 
("HKCU\Control Panel\Desktop\ScreenSaverIsSecure")
ssTimeout = WshShell.RegRead 
("HKCU\Control Panel\Desktop\ScreenSaveTimeout")
ssActive = WshShell.RegRead 
("HKCU\Control Panel\Desktop\ScreenSaveActive")
ScrnSave = WshShell.RegRead 
("HKCU\Control Panel\Desktop\SCRNSAVE.EXE")

If (isLocked = 0) or 
(CInt(ssTimeout) 900) Or (ssActive = 0) Or (ScrnSave = "") 
Then
 WshShell.RegWrite 
"HKCU\Control 
Panel\Desktop\ScreenSaverIsSecure",1,"REG_SZ"
 
WshShell.RegWrite "HKCU\Control 
Panel\Desktop\ScreenSaveActive",1,"REG_SZ"
 
WshShell.RegWrite "HKCU\Control 
Panel\Desktop\ScreenSaveTimeout",900,"REG_SZ"
 
WshShell.RegWrite "HKCU\Control Panel\Desktop\SCRNSAVE.EXE","%system 
root%\system32\logon.scr","REG_SZ"
 WshShell.Popup 
"ScreenSaver settings were not previously set. Settings have been 
updated. A logout is required to activate new settings. Click Ok and 
the system will logout you out now. Auto-logoff in 20 seconds.", 20, , 0 + 
64 
 
WshShell.Run LogonServer  "\netlogon\shutdown.exe /l 
/f",0,true
End 
If--- 
This message (including any attachments) is intended only for the use of 
the individual or entity to which it is addressed and may contain information 
that is non-public, proprietary, privileged, confidential, and exempt from 
disclosure under applicable law or may constitute as attorney work product. If 
you are not the intended recipient, you are hereby notified that any use, 
dissemination, distribution, or copying of this communication is strictly 
prohibited. If you have received this communication in error, notify us 
immediately by telephone and (i) destroy this message if a facsimile or (ii) 
delete this message immediately if this is an electronic communication. 
Thank you. 


RE: [ActiveDir] Vista WMI

2006-10-18 Thread Alain Lissoir



The caption is not corrupted. The branding introduces a (R) and a 
(TM).
First, under Vista, the Win32_OperatingSystem class is a singleton 
class now, meaning that you can locate the UNIQUE instance of that as 
follows:

Set colOperatingSystems = 
objWMIService.Get ("Win32_OperatingSystem=@")

It didn't make sense to enumerate this class when there is actuall 
only 1 instance of the class available. However you can continue to enumerate as 
before so, your script does not break on "before Vista 
platforms".

Next to test the Windows version, and not get your script breaking 
downlevel, you should use the following coding technique:

If Instr 
(objOperatingSystem.Caption, "Vista")  0 Then 
 If 
objOperatingSystem.OperatingSystemSKU = 3 Then 
 WScript.Echo 
"Home Basic Premium Edition"
  
wscript.quit
 End 
If
End 
If

To test the operating SKU (Home, Ultimate, Basic, etc), you should 
use OperatingSystemSKU property.

If you are pure Vista (and Longhorn server) and just need to 
determine the SKU of the OS:


Set colOperatingSystems = 
objWMIService.Get ("Win32_OperatingSystem=@")
Select Case 
objOperatingSystem.OperatingSystemSKU 
 
Case 0 
WScript.Echo "Undefined" 
Case 1 
WScript.Echo "Ultimate Edition" 
Case 2 
WScript.Echo "Home Basic Edition" 
Case 3 
WScript.Echo "Home Basic Premium Edition" 
Case 4 
WScript.Echo "Enterprise Edition" 
Case 5 
WScript.Echo "Home Basic N Edition"
.
.
.


HTH
/Alain

http://msdn.microsoft.com/library/default.asp?url="">


OperatingSystemSKU 
Data type: uint32

Stock Keeping Unit (SKU) number for the operating system. 
Windows Server2003, WindowsXP, Windows2000, 
  and WindowsNT4.0:This property is not available. 


Possible SKU values are:

  
  
Value
Meaning
  
0
Undefined
  
1
Ultimate Edition
  
2
Home Basic Edition
  
3
Home Basic Premium Edition
  
4
Enterprise Edition
  
5
Home Basic N Edition
  
6
Business Edition
  
7
Standard Server Edition
  
8
Datacenter Server Edition
  
9
Small Business Server Edition
  
10
Enterprise Server Edition
  
11
Starter Edition
  
12
Datacenter Server Core Edition
  
13
Standard Server Core Edition
  
14
Enterprise Server Core Edition
  
15
Enterprise Server IA64 Edition
  
16
Business N Edition
  
17
Web Server Edition
  
18
Cluster Server Edition
  
19
Home Server Edition
  
20
Storage Express Server Edition
  
21
Storage Standard Server Edition
  
22
Storage Workgroup Server Edition
  
23
Storage Enterprise Server Edition
  
24
Server For Small Business Edition
  
25
Small Business Server Premium 
Edition


From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Harding, 
DevonSent: Thursday, October 19, 2006 2:56 AMTo: 
ActiveDir@mail.activedir.orgSubject: [ActiveDir] Vista  
WMI


Im trying to get a script working 
in Vista with no success. For some reason 
the OS caption on Vista looks corrupted, but 
when I enter it as its displayed in wmic, my script ignores it. I even 
tried to correct it, and still no success. Heres the 
script:

Dim 
WshShell
strComputer = 
"."
Set WshShell = 
WScript.CreateObject("WScript.Shell")
On Error Resume 
Next

' If Workstation, exit 
script
Dim objWMIService, 
colOperatingSystems, objOperatingSystem, strComputer, 
objFSO
Set objWMIService = 
GetObject("winmgmts:"  "{impersonationLevel=impersonate}!\\"  
strComputer  "\root\cimv2")
Set colOperatingSystems = 
objWMIService.ExecQuery ("Select * from 
Win32_OperatingSystem")
For Each objOperatingSystem in 
colOperatingSystems
If objOperatingSystem.Caption = 
"Microsoft Windows 2000 Professional" then wscript.quit 

If objOperatingSystem.Caption = 
"Microsoft Windows XP Professional" then wscript.quit 

If objOperatingSystem.Caption = 
"Microsoftr Windows VistaT Ultimate" then 
wscript.quit
If objOperatingSystem.Caption = 
"Microsoft Windows Vista Ultimate" then wscript.quit 

Next

' Check / Set registry settings for 
screen saver. Logoff user if settings are 
updated
Dim isLocked, ssTimeout, ssActive, 
ScrnSave, wmi, objSet 

isLocked = WshShell.RegRead 
("HKCU\Control Panel\Desktop\ScreenSaverIsSecure")
ssTimeout = WshShell.RegRead 
("HKCU\Control Panel\Desktop\ScreenSaveTimeout")
ssActive = WshShell.RegRead 
("HKCU\Control Panel\Desktop\ScreenSaveActive")
ScrnSave = WshShell.RegRead 
("HKCU\Control Panel\Desktop\SCRNSAVE.EXE")

If (isLocked = 0) or 
(CInt(ssTimeout) 900) Or (ssActive = 0) Or (ScrnSave = "") 
Then
 WshShell.RegWrite 
"HKCU\Control 
Panel\Desktop\ScreenSaverIsSecure",1,"REG_SZ"
 
WshShell.RegWrite "HKCU\Control 
Panel\Desktop\ScreenSaveActive",1,"REG_SZ"
 
WshShell.RegWrite "HKCU\Control 
Panel\Desktop\ScreenSaveTimeout",900,"REG_SZ"
 
WshShell.RegWrite "HKCU\Control Panel\Desktop\SCRNSAVE.EXE","%system 
root%\system32\logon.scr","REG_SZ"
 WshShell.Popup 
"ScreenSaver settings were not previously set. 

Re: [ActiveDir] Vista WMI

2006-10-18 Thread Susan Bradley, CPA aka Ebitz - SBS Rocks [MVP]




Given that some of those suckers can't join domains... do you need to
list all of those?

AFAIK Home basic premium will only join a home domain. Granted Joe
will be scripting that...but the rest of us?

Alain Lissoir wrote:

  
  
  
  
  The caption is not corrupted. The
branding introduces a (R) and a (TM).
  First, under Vista, the
Win32_OperatingSystem class is a singleton class now, meaning that you
can locate the UNIQUE instance of that as follows:
  
  Set colOperatingSystems =
objWMIService.Get ("Win32_OperatingSystem=@")
  
  It didn't make sense to enumerate this
class when there is actuall only 1 instance of the class available.
However you can continue to enumerate as before so, your script does
not break on "before Vista platforms".
  
  Next to test the Windows version, and not
get your script breaking downlevel, you should use the following coding
technique:
  
  If
Instr (objOperatingSystem.Caption, "Vista")  0 Then 
   If
objOperatingSystem.OperatingSystemSKU = 3 Then 
  
WScript.Echo "Home Basic Premium Edition"
   
wscript.quit
   End
If
  End If
  
  To test the operating SKU (Home,
Ultimate, Basic, etc), you should use OperatingSystemSKU property.
  
  If you are pure Vista (and Longhorn
server) and just need to determine the SKU of the OS:
  
  
  Set colOperatingSystems =
objWMIService.Get ("Win32_OperatingSystem=@")
  Select Case
objOperatingSystem.OperatingSystemSKU
   Case 0
  
WScript.Echo "Undefined"
   Case
1
  
WScript.Echo "Ultimate Edition"
   Case
2
  
WScript.Echo "Home Basic Edition"
   Case
3
  
WScript.Echo "Home Basic Premium Edition"
   Case
4
  
WScript.Echo "Enterprise Edition"
   Case
5
  
WScript.Echo "Home Basic N Edition"
  .
  .
  .
  
  
  
  
  HTH
  /Alain
  
  http://msdn.microsoft.com/library/default.asp?url="">
  
  
  OperatingSystemSKU 
  Data type: uint32


Stock Keeping Unit (SKU) number for the operating system. 
Windows Server2003, WindowsXP, Windows2000, and
WindowsNT4.0:This property is not available. 
Possible SKU values are:

  

  Value
  Meaning


  0
  Undefined


  1
  Ultimate Edition


  2
  Home Basic Edition


  3
  Home Basic Premium Edition


  4
  Enterprise Edition


  5
  Home Basic N Edition


  6
  Business Edition


  7
  Standard Server Edition


  8
  Datacenter Server Edition


  9
  Small Business Server Edition


  10
  Enterprise Server Edition


  11
  Starter Edition


  12
  Datacenter Server Core Edition


  13
  Standard Server Core Edition


  14
  Enterprise Server Core Edition


  15
  Enterprise Server IA64 Edition


  16
  Business N Edition


  17
  Web Server Edition


  18
  Cluster Server Edition


  19
  Home Server Edition


  20
  Storage Express Server Edition


  21
  Storage Standard Server Edition


  22
  Storage Workgroup Server Edition


  23
  Storage Enterprise Server Edition


  24
  Server For Small Business Edition


  25
  Small Business Server Premium Edition

  

  
  
  
  
  From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Harding,
Devon
  Sent: Thursday, October 19, 2006 2:56 AM
  To: ActiveDir@mail.activedir.org
  Subject: [ActiveDir] Vista  WMI
  
  
  
  Im trying to get a
script working in Vista with no
success. For some reason the OS caption on Vista
looks corrupted, but when I enter it as its displayed in wmic, my
script ignores it. I even tried to correct it, and still no success.
Heres the script:
  
  Dim WshShell
  strComputer = "."
  Set WshShell =
WScript.CreateObject("WScript.Shell")
  On Error Resume Next
  
  ' If Workstation, exit
script
  Dim objWMIService,
colOperatingSystems, objOperatingSystem, strComputer, objFSO
  Set objWMIService =
GetObject("winmgmts:"  "{impersonationLevel=impersonate}!\\" 
strComputer  "\root\cimv2")
  Set colOperatingSystems =
objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
  For Each
objOperatingSystem in colOperatingSystems
  If
objOperatingSystem.Caption = "Microsoft Windows 2000 Professional" then
wscript.quit 
  If
objOperatingSystem.Caption = "Microsoft Windows XP Professional" then
wscript.quit 
  If