Stop using Windows????????? : )
I'm sorry, I couldn't resist the temptation.
- JD
LOL! I read the message a couple of times and could only assume it was
On 9/8/10 3:59 PM, "James Palmer" <jamespalmer at smsd.org> wrote:
sent to the wrong list.
--
William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492
Ok, just cause I feel bad about joking, I'll ask the VBscript guy here
if he knows the answer. I'll post back later with anything helpful he
may have to offer.
- JD
I got this back from our Windows genius. I can't help explain it though.
: )
The code itself looks ok to me and would run ok as long as the registry
key is present. One thing I noticed though is by checking the <> value
of dwValue, it can return an incorrect "Off" state. This can happen if
the key returns unexpected data because the script is simply checking
for one condition. A better method might be to check for a specific on
condition and off condition
(ex:
If dwValue = 1 Then 'or whatever the on value would be
Wscript.echo "<result>" & "On" & "</result>"
Else If dwValue = 0
Wscript.echo "<result> & "Off" & </result>"
Else
Wscript.echo "<result>" & "Unknown Condition" & "</result>"
End If
).
I would suggest checking the service itself as this value would be more
accurate than the registry key. Another thing is WMI sometimes gets
corrupted and doesn't run correctly. In this case you can use a Shell
object to check a registry value instead. I added both examples below:
A possible different way you might recommend is to just check the
service itself:
'This will check the service itself
strComputer = "."
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!" _
& strComputer & "
ootcimv2")
Set GetServices = oWMI.ExecQuery("SELECT * FROM Win32_Service WHERE
Name='SharedAccess'")
For Each Service In GetServices
WScript.Echo "<result>" & Service.State & "</result>"
' Values returned are: "Stopped", "Start Pending", "Stop Pending",
' "Running", "Continue Pending", "Pause
Pending",
' "Paused", "Unknown"
Next
Another way to check Registry key without using WMI as WMI can get
corrupted on some computers:
'This will read registry key without WMI
Set oShell = CreateObject("WScript.Shell")
dwValue = oShell.RegRead("HKLMSYSTEMCurrentControlSetServices" _
& "SharedAccessParametersFirewallPolicy" _
& "DomainProfileEnableFirewall")
if dwValue <> 0 then
WScript.Echo "<result>" & "On" & "</result>"
else
WScript.Echo "<result>" & "Off" & "</result>"
end if
Hope that helps,
I hope that helps too!
- JD
I don’t have any clue about this one either, I don’t know anything about VB. If, and when you get and answer to this, please post it to the Google group (link below) for others to find if needed.
Sean
http://groups.google.com/group/casper-extension-attributes?hl=en
power shell is a lot like Unix, but is a separate installer for any non
Windows 7 machine. I have dabbled in it, but never really used it all
that much.
power shell is a lot like Unix, but is a separate installer for any non Windows 7 machine. I have dabbled in it, but never really used it all that much.
We disable PowerShell from running on our machines. There was some security issue where if you allow it to run you couldn’t keep users from running it too or something like that. Might be worth looking into.
- JD
many thanks!
I'l give that a go..
i do feel somewhat dirty playing around with this stuff....
getting there!
No error & works as a VBS, but it doesn't update the JSS either... hmm.. might have to give support a bell..
Dim verNum
Const FOR_READING = 1
const HKEY_LOCAL_MACHINE = &H80000002
const strKeyPath = "SYSTEMCurrentControlSetServicesSharedAccessParametersFirewallPolicyDomainProfile"
const strValueName = "EnableFirewall"
strComputer = "localhost"
Set oReg=GetObject(
"winmgmts:{impersonationLevel=impersonate}!" &
strComputer & "
ootdefault:StdRegProv")
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
if dwValue = 1 then
WScript.Echo "<result>" & "On" & "</result>"
else if dwValue = 0 then
WScript.Echo "<result>" & "Off" & "</result>"
else
WScript.Echo "<result>" & "Error" & "</result>"
end if
end if