|
|
|||||||
code:Key exist fuction is not returning any thing !! any idea??$ReturnCode = KeyExist("HKEY_CURRENT_USER\Console") |
||||||||
|
|
|||||||
quote:No probs here. This key only exist after logon using win9x if I recall correctly. |
||||||||
|
|
|||||||
Now I change the script to read the value but still not working quote:This job is very urgent for me pls help... I am running the script from w2k PC my KIX ver is 4.21 |
||||||||
|
|
|||||||
it is not returning 0 or 1 |
||||||||
|
|
|||||||
Change this... quote:to this... quote:This works for me on W2K. Did a simple check with this code:Why not just use @PRODUCTTYPE$computer = @WKSTA [ 22. September 2003, 10:11: Message edited by: R2D2 ] |
||||||||
|
|
|||||||
That line is ok for me Just runt this line in ur pc code:just see $rdd and $rddl is returning "0" or "1"$RDD=KeyExist('\\'+remotepc+'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CompBatt') |
||||||||
|
|
|||||||
you are right buddy that was the issue, now it is working, basically I am trying to find out laptop's in my network here is my latest code. code:but I foung the reg. key which I am serching for LAptop is existing in some of my compaq PC's (D51c HP) can some body tell me any uneeque key which is only there in Laptop ?? |
||||||||
|
|
|||||||
Why don't you use @PRODUCTTYPE |
||||||||
|
|
|||||||
@PRODUCTTYPE wont say the PC is LAPTOP or normal !! quote: |
||||||||
|
|
|||||||
Yep. But I don’t see you using the producttype to find out if it’s a laptop or not. This... quote:...is used to see if it's a laptop or not. So I don't see any reason why the @PRODUCTTYPE can't be used. But everybody has its own preferences so if you like it better this way it's OK BTW, There’s still one little error in your script quote: [ 22. September 2003, 10:38: Message edited by: R2D2 ] |
||||||||
|
|
|||||||
As i said @producttype will not say the Machine is LAPTOP or normal PC then waht is the point of using it ? another thing quote:I found this key in few desktop PC's too, what else I can do to find out LAPTOP's?? |
||||||||
|
|
|||||||
In your script the productype is checked by looking into the registry and used to startup the laptop or desktop check. Checking on @PRODUCTTYPE will also give you Windows NT, 2000, XP or whatever. Saved the time to create a script that looks into the registry and eliminates possible errors. I've seen some people doing a check in the registry is any PCMCIA ports are installed (I think Radimus said some words about this some a few weeks ago). A standard desktop pc will not have PCMCIA ports installed. A check on @CPU might also do the trick. If you're laptops are recent there is a good change that they have a Pentium Mobile CPU. Not sure if @CPU returns the correct value for a mobile CPU because I can't test this now. |
||||||||
|
|
|||||||
ja. my laptop is already 2 years old. it says "Intel Pentium III" |
||||||||
|
|
|||||||
OK, that sucks. There must be some other way then. I'm almost sure I've seen something about checking for PCMCIA ports using WMI or reg checks or something. A few weeks ago. |
||||||||
|
|
|||||||
http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=2;t=004556 basically, compbatt, will exist on laptops and desktops with smart UPSs pcmcia cards are usually only in laptops, but not all... some PCs have them for smartcard readers. and some laptops bios may or may not provide the case type... like old inspiron 7000s, but newer ones will. |
||||||||
|
|
|||||||
I thought I saw the discussion at the end of last week. |
||||||||
|
|
|||||||
Here you go.. code:Thanks,BREAK ON Kent [ 22. September 2003, 17:36: Message edited by: kdyer ] |
||||||||
|
|
|||||||
Does WMI work on Win9x? If not here is the code I have used in the past. Seems to always work for me. code: |
||||||||
|
|
|||||||
Work on 9x, natively - no. You will need to download the following files for 9x/NT. WMI9X.EXE/WMINT4.EXE 2k/XP/2K3 have WMI built-in. Kent |
||||||||
|
|
|||||||
Hi, The following code is used to determine a W2K laptop: $PCMCIA=READVALUE("HKLM\SYSTEM\CurrentControlSet\Services\Pcmcia","Start") ? "If Value PCMCIA Is 0 Than This Is A Laptop, Else A Desktop, Value Is $PCMCIA" The following is used for W9x $PCMCIA=EXISTKEY("HKLM\System\CurrentControlSet\Services\Class\PCMCIA\0000") IF $PCMCIA=0 ? "This Is A Laptop" ENDIF I hope this is useful. regards, Marck |
||||||||
|
|
|||||||
PCMCIA and Battery are not always good reliable detection for a Laptop vs. Desktop. Kent |
||||||||
|
|
|||||||
kinda. but that is not trustable. like said already in THIS topic, pcmcia is not just for laptops. it normal standard, just like PCI and it is foundable in desktops too. |
||||||||
|
|
|||||||
We have about 2500 desktops and 1500 laptops and this script does the job. But Kent you are right, it won’t work in EVERY situation. We are not using any desktops with cardreaders, so.... [ 23. September 2003, 00:54: Message edited by: marck1 ] |
||||||||
|
|
|||||||
Please see this posting for an update to this code. http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=2&t=004591 |
||||||||
|
|
|||||||
marck1... The code I posted above has never failed. It also does not depend on PCMCIA or power mgmt software. The key...as far as I know will only be there if there is a physical battery in the machine. Everyone else... If someone could prove it wrong I would really apreciate it. Dont know why you would use some big WMI script when all you have to do is check for a registry key. Besides...I wish I could say we wont have any Win9x machines soon...But Im sure they will be around for a while. And IS is not going to spend the resources in adding WMI capabilities to them. [ 23. September 2003, 16:13: Message edited by: CitrixMan ] |
||||||||
|
|
|||||||
A UPS connected to a computer will also be detected as a battery. PCMCIA cards can be present in computers as well. The case type in WMI is not always set to the correct value. ScriptLogic has looked into this extensively and the best they could come up with is a proprietary solution, which they plan to patent. |
||||||||
|
|
|||||||
Yes but a UPS connector will not show up in the registry key I specified. I have tested with PCs that have UPS connected...Like I said...If anyone can prove it to be faulty, Please do so. |
||||||||
|
|
|||||||
Everybody, please give this UDF a try: IsLaptop() - Determines whether a local/remote computer is a laptop . The code below will display all computers in a domain and whether they're laptops or not. Windows 9x computers must have remote registry access enabled to be classified as laptop. code:$sComps=NetView2() |
||||||||
|
|
|||||||
Don't want to really run against my entire Domain right now as that takes hours to run, but so far on about a dozen computers it appears to work well. Hopefully CitrixMan is correct. I know WMI is a pig, but since you have to use it for some other things, nice to have another method of getting data. This Reg method is quicker for sure, but if you want to get back the other data then this looks good too. http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=2&t=004591 [ 24. September 2003, 00:23: Message edited by: NTDOC ] |
||||||||
|
|
|||||||
I just wanted a quick binary IsLaptop check for the client-side, primarily login scripts. The WMI approach is more better suited for admin scripts, IMHO. |
||||||||
|
|
|||||||
Well I haven't gotten there yet, but I'm hoping to run silent scripts with WKIX32.EXE and I want to probably sleep the script for maybe a couple minutes after logon before it starts to really do anything. At that point as long as you are not stealing all the CPU cycles and bandwidth of the client, you should be able to do similar things like MS SMS does and do background processing. I am currently re-writing my entire logon script (thus all the recent posts about repairing scripts and UDFs to support the NoVarInStrings) Nice posting by Howard about the SetOptions. Seems some things are not a clear as one would initially think. I'm assuming that this will be the best practice for my new script. DIM $Set1,$Set2 $Set1=SetOption('Explicit','ON') $Set2=SetOption('NoVarsInStrings','ON') |
||||||||
|
|
|||||||
My standard script header: code:DEBUG OFF |
||||||||
|
|
|||||||
I had two days off from Office, It is glad to know that the topic is still hot. Any ways I checked Citrix man's script and sorry to say that I found that key(PNPOCOA) in 4 desktop PC's in my company which is Compaq D51C/P253. thees PC was having COMPBATT key too where my script failed first time. I found NTDOC (WMI query) was only Possible but as somebody said WMI is good only for admin script, I found that if I add WMI script in my login script and machine doesn’t have WMI installed the entire script is failing to proceed. I'll say what is my actual requirement to find laptop, My laptop users are taking their machines at home this is causing a virus threat, so we decided to write a script to check the dat version in laptop if it is old show a message to call help desk and log them off without further mercy !! Pls let me know is there any other way to do this ... this is the requirement from or Vice president of I.T. I'll post my old code code:$laptop=KeyExist("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CompBatt") |
||||||||
|
|
|||||||
quote:If that is the case, install WMINT4.EXE/WMI9X.EXE to address this.. Kent |
||||||||
|
|
|||||||
It's a long way I guss, I have to find out the PC's which dosent have WMI and install it..... I am looking for a quick solution. |