Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - get inactive computers

Reply
 
Old 06-24-2008   #1 (permalink)
Gobba


 
 

get inactive computers

Why doesnt this work when i get multiple answeres? When i get only one
object it works i.e if i specify a computer name instead of jag-*.

(get-qadcomputer -service un.dr -dudip -ip ('lastlogon') jag-
*).lastlogon

if i do:
get-qadcomputer -service un.dr jag-* |%{ (get-qadcomputer
$_).lastlogon }

it works but is REALLY slow.

Im trying to make a script telling me which computers hasnt been used
in a couple of months and to deactivate them.

Any tip anyone?

-gob

My System SpecsSystem Spec
Old 06-24-2008   #2 (permalink)
Gobba


 
 

Re: get inactive computers

Oh nice! Thats what ive been missing in the rest of my scripts to!
Need to read up on select. Thanks alot!

-gob

On 24 Juni, 10:47, Shay Levi <n...@xxxxxx> wrote:
Quote:

> Hi Gobba,
>
Quote:

> > (get-qadcomputer -service un.dr -dudip -ip ('lastlogon') jag- *).lastlogon
>
> This can return multiple computer objects and PowerShell can't decide which
> object's 'lastlogon' to display. It is good for one object only.
>
> Take this for example:
>
> PS 33> dir *.txt
>
> Mode * *LastWriteTime * * * * * Length Name * * * ** * * * * * * * *
> ---- * *------------- * * * * * ------ ---- * * * ** * * * * * * * *
> -a--- * 15/05/2008 17:13:04 * 141.7 KB text1.txt * * * * * * *
> -a--- * 06/03/2008 14:20:56 * 252.3 KB text2.txt
> -a--- * 12/03/2008 14:51:05 * * 56.0 B *text3.txt
>
> PS 34> (dir *.txt).name
>
> Which text file name should PowerShell return?
>
> Try this instead:
>
> get-qadcomputer -service un.dr jag-* -ip lastlogon | select name, lastlogon
>
> ---
> Shay Levi
> $cript Fanatichttp://scriptolog.blogspot.com
>
> G> Why doesnt this work when i get multiple answeres? When i get only
> G> one object it works i.e if i specify a computer name instead of
> G> jag-*.
> G>
> G> (get-qadcomputer -service un.dr -dudip -ip ('lastlogon') jag-
> G> *).lastlogon
> G>
> G> if i do:
> G> get-qadcomputer -service un.dr jag-* |%{ (get-qadcomputer
> G> $_).lastlogon }
> G> it works but is REALLY slow.
> G>
> G> Im trying to make a script telling me which computers hasnt been used
> G> in a couple of months and to deactivate them.
> G>
> G> Any tip anyone?
> G>
> G> -gob
> G>
My System SpecsSystem Spec
Old 06-24-2008   #3 (permalink)
Shay Levi


 
 

Re: get inactive computers

Hi Gobba,

Quote:

> (get-qadcomputer -service un.dr -dudip -ip ('lastlogon') jag- *).lastlogon
This can return multiple computer objects and PowerShell can't decide which
object's 'lastlogon' to display. It is good for one object only.


Take this for example:

PS 33> dir *.txt

Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 15/05/2008 17:13:04 141.7 KB text1.txt
-a--- 06/03/2008 14:20:56 252.3 KB text2.txt
-a--- 12/03/2008 14:51:05 56.0 B text3.txt


PS 34> (dir *.txt).name

Which text file name should PowerShell return?



Try this instead:

get-qadcomputer -service un.dr jag-* -ip lastlogon | select name, lastlogon



---
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com

G> Why doesnt this work when i get multiple answeres? When i get only
G> one object it works i.e if i specify a computer name instead of
G> jag-*.
G>
G> (get-qadcomputer -service un.dr -dudip -ip ('lastlogon') jag-
G> *).lastlogon
G>
G> if i do:
G> get-qadcomputer -service un.dr jag-* |%{ (get-qadcomputer
G> $_).lastlogon }
G> it works but is REALLY slow.
G>
G> Im trying to make a script telling me which computers hasnt been used
G> in a couple of months and to deactivate them.
G>
G> Any tip anyone?
G>
G> -gob
G>


My System SpecsSystem Spec
Old 06-24-2008   #4 (permalink)
Shay Levi


 
 

Re: get inactive computers


Check this post too regarding which attribute to query:

LastLogon Date for a List of Users .CSV




---
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com

SL> Hi Gobba,
SL>
Quote:
Quote:

>> (get-qadcomputer -service un.dr -dudip -ip ('lastlogon') jag-
>> *).lastlogon
>>
SL> This can return multiple computer objects and PowerShell can't
SL> decide which object's 'lastlogon' to display. It is good for one
SL> object only.
SL>
SL> Take this for example:
SL>
SL> PS 33> dir *.txt
SL>
SL> Mode LastWriteTime Length Name
SL> ---- ------------- ------ ----
SL> -a--- 15/05/2008 17:13:04 141.7 KB text1.txt -a---
SL> 06/03/2008 14:20:56 252.3 KB text2.txt -a--- 12/03/2008 14:51:05
SL> 56.0 B text3.txt
SL>
SL> PS 34> (dir *.txt).name
SL>
SL> Which text file name should PowerShell return?
SL>
SL> Try this instead:
SL>
SL> get-qadcomputer -service un.dr jag-* -ip lastlogon | select name,
SL> lastlogon
SL>
SL> ---
SL> Shay Levi
SL> $cript Fanatic
SL> http://scriptolog.blogspot.com
G>> Why doesnt this work when i get multiple answeres? When i get only
G>> one object it works i.e if i specify a computer name instead of
G>> jag-*.
G>>
G>> (get-qadcomputer -service un.dr -dudip -ip ('lastlogon') jag-
G>> *).lastlogon
G>>
G>> if i do:
G>> get-qadcomputer -service un.dr jag-* |%{ (get-qadcomputer
G>> $_).lastlogon }
G>> it works but is REALLY slow.
G>> Im trying to make a script telling me which computers hasnt been
G>> used in a couple of months and to deactivate them.
G>>
G>> Any tip anyone?
G>>
G>> -gob
G>>


My System SpecsSystem Spec
Old 06-24-2008   #5 (permalink)
Brandon [MVP]


 
 

Re: get inactive computers

If the environment is 2k3+ I would use LastLogonTimeStamp its replicated and
this is precisely what it was designed for.


"Gobba" <gobba@xxxxxx> wrote in message
news:f68830fc-37ce-4cad-8061-6fc207aef418@xxxxxx
Quote:

> Why doesnt this work when i get multiple answeres? When i get only one
> object it works i.e if i specify a computer name instead of jag-*.
>
> (get-qadcomputer -service un.dr -dudip -ip ('lastlogon') jag-
> *).lastlogon
>
> if i do:
> get-qadcomputer -service un.dr jag-* |%{ (get-qadcomputer
> $_).lastlogon }
>
> it works but is REALLY slow.
>
> Im trying to make a script telling me which computers hasnt been used
> in a couple of months and to deactivate them.
>
> Any tip anyone?
>
> -gob
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
find inactive computers PowerShell
Inactive icons General Discussion
Window randomly goes inactive Vista General
Inactive computers in Vista Active Directory Vista General
Can 2 xp computers and 2 vista computers exist in a family network Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46