wpietrzakpl / GlpiTools

PowerShell Module to work with Glpi API
15 stars 8 forks source link

computerId #8

Closed ludovicbernard closed 5 years ago

ludovicbernard commented 5 years ago

How to have the computerid with only computername?

wpietrzakpl commented 5 years ago

Hi, Thank you for comment :) I assume, you have computer name and you want to get ID of that computer.

This is the situation which I decribed in #6 , I think there is solution :)

ludovicbernard commented 5 years ago

ok thanks for the glpi view, I found a way to do it, here is the method $ rall = get-glpitoolscomputer -all $ rcomputer = $ rall | select name, id | where {$ _. name -match "computer"}

$ computer.id

thanks for super glpitools

wpietrzakpl commented 5 years ago

Yes, you can do it like that, It's another approach :) maybe not that fast like search function but...

ludovicbernard commented 5 years ago

the goal is to find the MAC of the computer. that she is the command that allows to do that ?

wpietrzakpl commented 5 years ago

Look, you can get Computer object with parameter "WithNetworkPorts" $t = Get-GlpiToolsComputers -ComputerId id -Raw -Parameter WithNetworkports Then $t._networkports.NetworkPortEthernet

And you will get All informations about network on desired Computer Here is mac property

ludovicbernard commented 5 years ago

yes nickel, how to find the arguments "_networkports.NetworkPortEthernet "?

ludovicbernard commented 5 years ago

if we have more than one network interface, it takes what interface ?

wpietrzakpl commented 5 years ago

Under the variable $t is Computer object, using . (dot) you reffer to parameters :) $t | Get-Member gives you better view on available parameters ;)

wpietrzakpl commented 5 years ago

It gives you back All interfaces

ludovicbernard commented 5 years ago

ok, on the computer, I have

wpietrzakpl commented 5 years ago

Look how I have: $t = Get-GlpiToolsComputers -ComputerId id -Raw -Parameter WithNetworkports image Then $t._networkports image And image

And you will see all network interfaces of computer After that you have to filter the results for interface you want (Where-Object)

ludovicbernard commented 5 years ago

ok , merci. with the formcreator plugin, does it exist an API?

wpietrzakpl commented 5 years ago

Not in mine, maybe later I will implement commands for FormCreator, but this is the future :)

ludovicbernard commented 5 years ago

I will follow this module glpitools because it is really very good, nice job. strongly the future.

wpietrzakpl commented 5 years ago

Thank you :) I think we can close the issue