Thursday, September 12, 2019

Powershell - Get computers IMEI, and SIM card number ~ Remote PC

I just went through a marathon session, setting up several Dell 7212 Rugged tablets, that came with their SIM card already inserted...

In order to activate the cellular capabilities with a carrier, the following two details are required...
     But these are kind of a hassle to get to. And to work with...
  •      The IMEI number (device ID)
  •      The SIM card number

I found it MUCH easier to get to this info from my own computer, than from the tablet, as follows:
   ~ Note - About the Test-WSMan, PsExec, and the winrm config...
    ~ These just make sure WinRM is enabled. 

     ~ 'Invoke-Command' requires WinRM


$Target = "HOSTNAME"

$TestCommand = $null
$TestCommand = Test-WSMan -ComputerName $Target
If (!($TestCommand)){C:\SysInternals\PsExec.exe -s -nobanner \\$Target /accepteula cmd /c "c:\windows\system32\winrm.cmd quickconfig -quiet"}

$Network_IMEI = Invoke-Command -ComputerName $Target -ScriptBlock { netsh mbn show interfaces }
$Network_SIM = Invoke-Command -ComputerName $Target -ScriptBlock { netsh mbn show read interface=* }
$IMEI = ((($Network_IMEI | select-string "device id").ToString()).Trim()).replace('              ','')
$SIM = ((($Network_SIM | select-string "SIM ICC Id").ToString()).Trim()).replace('       ','')
Write-Host "Cellular device info:" -ForegroundColor Cyan -BackgroundColor DarkGreen
$IMEI
$SIM

There's plenty of extra lines in there, to make it look pretty, but you should get the point, pretty easily.
The two pieces (from what I could see), are in different parts of the mnb. So... Two commands.

It took me a while to figure this all out... To get BOTH the IMEI number, and the SIM card number.

Hope it helps someone else!


25 comments:

  1. I want you to thank for your time of this wonderful read!!! I definately enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog! samsung phones for sale

    ReplyDelete
    Replies
    1. Thank you kindly!
      I love playing around in Powershell - Glad to find that I'm able to help others.

      Delete
  2. Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking. sims mobile cheats iphone

    ReplyDelete
  3. Oh my goodness! an amazing article dude. Thanks Nevertheless I am experiencing concern with ur rss . Don’t know why Unable to subscribe to it. Is there anybody getting an identical rss downside? Anyone who is aware of kindly respond. Thnkx ipad sketch

    ReplyDelete
  4. I think this is among the most vital info for me. And i am glad reading your article. But want to remark on some general things, The site style is great, the articles is really great : D. Good job, cheers ipad mockup

    ReplyDelete
  5. I impressed, I must say. Actually hardly ever do I encounter a blog that each educative and entertaining, and let me let you know, you have got hit the nail on the head. Your concept is outstanding; the difficulty is something that not enough people are talking intelligently about. I am very glad that I stumbled across this in my search for something regarding this. macbook mockup

    ReplyDelete
  6. I just couldn’t depart your site prior to suggesting that I extremely enjoyed the standard information an individual provide for your visitors? Is gonna be back frequently in order to inspect new posts android mockups

    ReplyDelete
  7. Absolutely pent subject matter, appreciate it for selective information . android phone template

    ReplyDelete
  8. I am so grateful for this post and thanks such a lot for sharing it with us. app store mockup

    ReplyDelete
  9. I would like to thnkx for the efforts you have put in writing this blog. I am hoping the same high-grade website post from you in the upcoming also. In fact your creative writing abilities has inspired me to get my own website now. Actually the blogging is spreading its wings fast. Your write up is a good example of it. imac mockup

    ReplyDelete
  10. This is really fascinating, You are a very professional blogger. I’ve joined your rss feed and sit up for searching for more of your great post. Also, I have shared your site in my social networks! apple watch template

    ReplyDelete
  11. Some genuinely nice stuff on this website , I enjoy it. front end service

    ReplyDelete
  12. There's lots of dissertation internet websites via the internet at the time you get unsurprisingly discussed as part of your page. russian sim panel

    ReplyDelete
  13. Quickly this particular site may undoubtedly gain popularity in between just about all running a blog as well as site-building people, because of its painstaking articles or maybe evaluations. บาคาร่า

    ReplyDelete
  14. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. ip69k pc

    ReplyDelete
  15. Now i'm enthusiastic any placed. It is actually great to see a lot of people verbalize from the character not forgetting capacity about in which essential matter location are often perfectly identified. https://reelpolice.com/

    ReplyDelete
  16. Quickly this particular site may undoubtedly gain popularity in between just about all running a blog as well as site-building people, because of its painstaking articles or maybe evaluations. ufabet

    ReplyDelete
  17. Hi there! Nice stuff, please do tell me when you finally post something like this! แทงบาคาร่า

    ReplyDelete
  18. Hey i’m for the first time here. I came across this board and I find It seriously helpful & it helped me out much. I hope to give something back and aid others as you aided me. UFABET

    ReplyDelete
  19. However, even if some of the concepts have not changed, the application context as well as the learners' context has. see this post

    ReplyDelete
  20. I read your blog frequently, and I just thought I’d say keep up the fantastic work! It is one of the most outstanding blogs in my opinion. sim card reader

    ReplyDelete
  21. I appreciate everything you have added to my knowledge base.Admiring the time and effort you put into your blog and detailed information you offer.Thanks. Water Damage

    ReplyDelete