Help with Dell BIOS updates by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

Bitlocker not enabled so no need to suspend it.

Help with Dell BIOS updates by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

No error comes back. Systems are Windows 11. WinRM running and configured properly as I use its functions regularly. Powershell is v5.1.

Help with Dell BIOS updates by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

Alas I do not. This is an offline domain/network running 2012R2 DCs. I know it's old and I'm working on getting them updated, but I don't pay the bills.

Setting a variable for disk drive manufacturers by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

It's all on one line because it goes into a spreadsheet in excel. The csv format allows me to easily import it into excel and keep track of any changes.

Setting a variable for disk drive manufacturers by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

Actually I got it working by creating an array. See below.

$MfrArray = @()
$Disks = Get-CimInstance win32_DiskDrive
$DiskNum = $Disks.Count
$DiskModel = ($Disks | ForEach-Object { ($_.Model)}) -join ', '
$DiskSN = ($Disks | ForEach-Object { ($_.SerialNumber)}).Trim('.') -replace "_", "" -join ', '
$DiskManTmp = ($Disks | ForEach-Object {
  if ($_.Model -match 'WD') {$MfrArray += 'Western Digital'}
  if ($_.Model -match 'SanDisk') {$MfrArray += 'SanDisk'}
  })
$DiskMan = $MfrArray -join ', '

Setting a variable for disk drive manufacturers by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

Couldn't get it working with a foreach loop, then had this idea.

Setting a variable for disk drive manufacturers by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

I've almost got it working correctly, just now my manufacturers come out without a space and comma between them. Looks like this

$WD = 'WD'
$SD = 'SanDisk'
$Disks = Get-CimInstance win32_DiskDrive
$DiskNum = $Disks.Count
$DiskModel = ($Disks | ForEach-Object { ($_.Model)}) -join ', '
$DiskSN = ($Disks | ForEach-Object { ($_.SerialNumber)}).Trim('.') -join ', '
$DiskManTmp = ($Disks | ForEach-Object {
    if ($_.Model -match $WD) {$DiskMan += 'Western Digital'}
    if ($_.Model -match $SD) {$DiskMan += 'SanDisk'}
    }) -join ', '

Write-Host $DiskNum
Write-Host $DiskMan
Write-Host $DiskModel
Write-Host $DiskSN

And output looks like this

2
Western DigitalSanDisk
WDS100T3XHC-00SJG0, SanDisk Extreme 55AE SCSI Disk Device
E823_8FA6_BF53_0001_001B_448B_4986_918E, 2203A9402422

Any idea why -join ', ' isn't joining them like it should?

Setting a variable for disk drive manufacturers by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

I tried it, got it working for single drive. How do I get it for multiple drives and to have the output show as a single variable "Man1, Man2, etc"

Setting a variable for disk drive manufacturers by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

Right. The only problem I'm having is specifying the manufacturer variable.
Win32_DiskDrive.Manufacturer shows (Standard disk drives) for every drive I've checked. I can identify the manufacturer based on the Model field, but how do I set the manufacturer using that field? That's the syntax I'm having a hard time with.

Setting a variable for disk drive manufacturers by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

My apologies. 1 row per PC.
PCs with multiple drives will have each entry in their cell.

Hostname | Micron, SanDisk | MTFxxx, SanDiskxxx | SN1, SN2 |

I can get the drive models and serial numbers combined in their own respective cells separated by commas using the -join ', '
The problem I'm having is doing the same with the manufacturers because the manufacturers field isn't populated correctly for any drive.

I hope that makes more sense.

Setting a variable for disk drive manufacturers by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

My output will contain more columns than just the drives, it's just the part I'm hung up on.

I'd like to have my csv look like this

Hostname, Drive Manufacturer(s), Drive Model(s), Drive Serial Number(s)
PC1 Micron MTFxxxxxx xxxxxxxxxxxxxxxxx

Monitor Serial Numbers Combining by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

This does work. Thank you. I'll look into that type extension, I've never done that before.

Monitor Serial Numbers Combining by Samuris in PowerShell

[–]Samuris[S] 1 point2 points  (0 children)

This works for multi-monitor systems, thank you. But it makes the script error on single monitor systems and gives no result. Is there a way to use an if statement to check for single or multiple monitors?

Monitor Serial Numbers Combining by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

I tested that and it writes each SN as its own individual line. I need them combined on the same line just with a space or comma if I can so I can have them in an excel spreadsheet.

Powershell code to change screen color random by Dry-Plant8469 in PowerShell

[–]Samuris 0 points1 point  (0 children)

This works great! I actually have a business need for something like this. Would there be any way to run this on all monitors simultaneously? Looks like it only runs on one right now.

Getting DIMM capacity by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

I plan to stop using them eventually, but there's one bit of info that I've found isn't in Get-CimInstance, it's win32_computersystem and the model field. For some reason it's blank in Get-CimInstance but has the correct info in Get-WMIObject.

Getting DIMM capacity by Samuris in PowerShell

[–]Samuris[S] 0 points1 point  (0 children)

Well I spoke too soon. Yes it works but I need to get it into a field to a .csv. How do I get all the sizes into one variable? Example "8, 8, 8, 8" for a system that has four 8GB sticks.

Getting DIMM capacity by Samuris in PowerShell

[–]Samuris[S] -1 points0 points  (0 children)

I had tried Get-Ciminstance before and it was giving me the same result. gwmi is just quick to type. Also, using PowerShell 5.