chgl
asked on
DStools and powershell
Hi Guys,
We have server 2003 r2 and therefore do no have the powershell module for AD.
On powershell i typed in
$comp=dsquery computer -name *
it give me the full OU path e.g "CN=PC249083166313,OU=WA Computers,OU=Wales (WA),OU=Professional Services (PS),OU=Departmental Accounts,OU=CI,DC=ci,
DC=org"
however I only need the computer name in the variable $comp,
I then need to run an query and find out who is logged onto these machines and put it in an excel spreadsheet. How can I do this?
Thank in advance for the help.
Regards,
k
We have server 2003 r2 and therefore do no have the powershell module for AD.
On powershell i typed in
$comp=dsquery computer -name *
it give me the full OU path e.g "CN=PC249083166313,OU=WA Computers,OU=Wales (WA),OU=Professional Services (PS),OU=Departmental Accounts,OU=CI,DC=ci,
DC=org"
however I only need the computer name in the variable $comp,
I then need to run an query and find out who is logged onto these machines and put it in an excel spreadsheet. How can I do this?
Thank in advance for the help.
Regards,
k
ASKER
^ Hi we don't have powershell for AD, and I don't want it right now.
I need to know how to get the computer name from "dsquery computer -name *" into a variable.
I need to know how to get the computer name from "dsquery computer -name *" into a variable.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you Subsun and Qlemo - very useful.
However I am trying to learn how to split the data in an array, this is also my intent for asking.
However I am trying to learn how to split the data in an array, this is also my intent for asking.
However I am trying to learn how to split the data in an arraySorry, I am not clear about the question. Which data you want to split? Can you please explain?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Qlemo,
Thank you very much, very useful and it works!
However please can you send me a link that explains what youve written because I dont understand the [^ .... [2]
Many thanks again.
Thank you very much, very useful and it works!
However please can you send me a link that explains what youve written because I dont understand the [^ .... [2]
Many thanks again.
ASKER
what does the '$1' and the [2] mean?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Give below a test, if you need tweaking there are some other really good guys here who can collaborate to get you where you need to be.
I am exporting to csv you should have no problem simply opening the csv file in excel.
Open in new window