How to Set BIOS serialnumber with WMIC command - command-line

I have a need to change the serial number of windows device.
I am able to get the serial number using
wmic bios get serialnumber
Is there a way I can change the serialNumber using some set command.

Related

How do I change the hostname of a Windows PC with batch or powershell

I want to change the hostname of a computer from Batch (a.k.a. Command Prompt) or Powershell.
Initially I started research into using the wmic command. But running wmic /? on Windows 10 21H1 indicates it is now deprecated.
Then I looked at Get-WmiObject. But when I run man Get-WmiObject in PowerShell, the description indicates it has been "superseded" by Get-CimInstance.
Using the old Get-WmiObject command you could change your own computer's hostname with (Get-WmiObject Win32_ComputerSystem).Rename("New-Hostname").
What is a non-deprecated way to change your own Windows computer's hostname using Batch or PowerShell?
Thanks to #Theo for the tip.
The PowerShell command Rename-Computer
Rename-Computer "new-hostname"
Admin privileges and a computer restart are required.
The command warns you if the length of the hostname is longer than 15 characters.
The batch-file command...
NETDOM RENAMECOMPUTER "%ComputerName%" /Newname:"NewNameGoesHere" /FORCE
I made a simple code if you want to use it
#echo off
set /p newname=The name of the new device:
wmic computersystem where name="%computername%" call rename name="%newname%"
Anyway, this is what you are looking for
wmic computersystem where name="%computername%" call rename name="newname"

Get printers installed from server from remote computer using Powershell

I'm trying to write a script in powershell that will get all the installed printers in each computer.
At my organization we use a print server running win server 2019 to manage and share all the printers.
For some reason the commands
Get-Printer and win32_Printer return only the locally installed printers (which are the windows defaults like ms print to pdf).
I've tried to run the lines on the server itself and got the full list cause they are installed locally.
Is there a way the get a printer that was installed from a server? And in the future I will also want to install and uninstall those printers via powershell.
I have a function that does this, specifically, for our environment, but it relies on several other "self-coded" functions, so I'm not going to paste it here.
What you need to do is connect to the registry on the remote computer and interrogate it. The subkeys for HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Connections are GUIDs, and interrogating the PRINTER property of each of those subkeys will give you the UNC pathname of the connected printer.
This does NOT return the locally-defined printers; for that, you need Get-Printer.

Set -Clipboard -path on remote connected computer

I am typing the following command in Windows Powershell into a remote connected computer:
(code noted below)
I am getting the error message in windows Powershell :
Set-Clipboard : Cannot find drive. A drive with the name 'Q' does not exist.
HOWEVER, if I do the same when directly connected than the code works fine.
Could you please advise.
Thanks
Set-Clipboard -Path "Q:\Myname X\2019\07- Mon\City Name Job Nbr XXX 00-99"
I'm speculating a bit because you didn't provide the command line you used to connect to the remote machine. Probably the Q: drive represents a mapped network drive (unless you have a lot of USB/SATA drives connnected). You can confirm by running net use at a command prompt to show all the mapped drives and Remote/UNC paths. It should look like this
Status Local Remote Network
-------------------------------------------------------------------------------
Connected Q: \\server\share\ Microsoft Windows Network
You were probably remotely connected with the same account you use to log in, but it doesn't map all the drives when you are using a remote session. You can try to either map the drive in the remote session with net use q: \\server\share or you can try to use the full UNC path in your command line:
Set-Clipboard -Path "\\server\share\Myname X\2019\07- Mon\City Name Job Nbr XXX 00-99"
Where Server and Share are the values you got from the net use Remote column.

Powershell printer script

I will translate my question in english so that everyone can read it!
Am not really good in powershell i work on it for 3 days.
I need to create a powershell script to show what is the default printer selected in the computer ( example :PrinterA) before the execute a line to select another printer as default printer ( PrinterB) .
After that i need to reset the old default printer ( PrinterA).
I execute line:
Get-WmiObject -query " SELECT * FROM Win32_Printer WHERE Default=$true"
to show default printer but i dont know how to memorize it.
To select the (printeB ), I do:
RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "PrinteB"
Can you help me please ?
I'd use
$OldDefaultPrinter = (Get-WmiObject win32_printer | Where-Object Default -eq $True).Name
To store the current default printer in a variable.
To restore with your method
RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "$OldDefaultPrinter"
you did not mention the specific version of Powershell that you are using. [grin] presuming you are running ps5.1 on win10, you can use the print management cmdlets to do what you need. take a look at this ...
PrintManagement
— https://learn.microsoft.com/en-us/powershell/module/printmanagement/?view=win10-ps
the Get-Printer cmdlet will get info about the available printers. the Set-Printer cmdlet will let you set the default printer.

Determine Bitlocker version with PowerShell

I am trying to determine if BitLocker is updated. All I can find on BitLocker is if the service is running as in:
Get-Service -name "BDESVC*"
Usually the gwmi -class Win32_SoftwareFeature will return all applications versions but BitLocker isn't there. Does BitLocker need updating? Is it stored somewhere else?
I am using Win7 64bit PowerShell v2
After some lengthy searching, I found manage-bde. This command works great with the command line and PowerShell. I still am having an issue with pulling just the version number though.
Yes, this is the only option available for checking the version as the application isn't standalone. On Max OS X, it is the same. The version isn't made obvious or available.
In case this helps some one now, you can use the following command to extract the required information for your purpose.
Command
manage-bde -status C: | FINDSTR "\<version"
Result
BitLocker Drive Encryption: Configuration Tool version 10.0.15063
Please don't forget the '\<' because this is used to filter out the version, else other data containing the word 'conversion' also gets populated.