我有一个脚本,它使用 API 从我们的 MDM 中提取有关手机设备的数据。它创建一个包含许多列的 .csv 文件。IMEI 列显示为(例如)3.343434+14,而不是显示 334343412345678912345。谁能帮我看看如何在 .csv 文件中正确输出此输出?我可以在事后操纵列属性,但宁愿它只是正确的。当我真的希望它是一个数字/整数时,输出似乎是一般的。
我不知道在哪里可以输入 [int] (如果这甚至是解决此问题所需要的)。
$data = $response.Device
$data | foreach {
$serial = $_.SerialNumber
$phone = $_.PhoneNumber
$ownership = $_.Ownership
$enrollstat = $_.EnrollmentStatus
$compliant = $_.ComplianceStatus
$user = $_.UserName
$asset = $_.AssetNumber
$getlast = $_.LastSeen
$imei = $_.Imei
$lastdate = [DateTime]$getlast
try{$lastdate = Get-Date $getlast}
catch{write-host "NULL Date $serial"}
$object = New-Object -TypeName PSObject
$object | Add-Member -Name 'Serial Number' -MemberType NoteProperty -Value $serial
$object | Add-Member -Name 'Phone Number' -MemberType Noteproperty -Value $phone
$object | Add-Member -Name 'IMEI' -MemberType NoteProperty -Value $imei
$object | Add-Member -Name 'Ownership' -MemberType Noteproperty -Value $ownership
$object | Add-Member -Name 'Enrollment Status' -MemberType Noteproperty -Value $enrollstat
$object | Add-Member -Name 'Compliance Status' -MemberType Noteproperty -Value $compliant
$object | Add-Member -Name 'User' -MemberType Noteproperty -Value $user
$object | Add-Member -Name 'Asset Number' -MemberType Noteproperty -Value $asset
$object | Add-Member -Name 'Last Seen Date' -MemberType NoteProperty -Value $lastdate
我希望 .cvs 列显示整个 IMEI 号码,并且没有小数,也不会被截断。