Functions/Public/Start-COVCellInfo.ps1
function Start-COVCellInfo { param ( [Parameter(Mandatory)] [string] $Target ) $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 $File = $Target + '.txt' $Log = New-Item -Path $env:USERPROFILE\CellInfo\$File Add-Content $Log " Janet, Can we activate and deactivate the following Verizon devices: Old Asset: $Target IMEI: $IMEI SIM: $SIM New Asset: IMEI: SIM: " Invoke-Item $Log } |