In addition to other answers, here are some useful information that can be retrieved using PowerShell: Show
Querying OS & Hardware Info via PowerShell: Querying General OS (Operating System) Information: Quickest way to view the OS name: cmd ?#Using Get-ComputerInfo: Get-ComputerInfo | select WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer#Using Get-WmiObject: $name=(Get-WmiObject Win32_OperatingSystem).caption $bit=(Get-WmiObject Win32_OperatingSystem).OSArchitecture $ver=(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId Write-Host " OS-Name: `t $name `n Architct: `t $bit `n Release: `t $ver"To list Major Minor Version info: [System.Environment]::OSVersion.VersionQuerying HostName: $Env:ComputerNameOR hostname #cmd commandAlso, if you know the IP address, use the "ping" command (e.g.: ping /a <your_ip_address>) you will see your "hostname" in first line. Querying Current (Logged-in) User: whoami #cmd commandOR [System.Security.Principal.WindowsIdentity]::GetCurrent().NameQuerying Mapped Drives: List Mapped Drives - using WMI: Get-WmiObject -Class Win32_LogicalDisk | Format-TableOR wmic logicaldisk get name #list just logical-drive lettersOR, to list logical-drive info: FreeSpace, Provider (Real Network Location), Size, and VolumeName: wmic logicaldisk list briefList Mapped Drives - using [DriveInfo] class: [System.IO.DriveInfo]::GetDrives()List Removable Drives: $drives = [System.IO.DriveInfo]::GetDrives() $r = $drives | Where-Object { $_.DriveType -eq 'Removable' -and $_.IsReady } if ($r) { return @($r)[-1] }Querying disk capacity, space & Volume-Type Invoke-Command -ComputerName S1 {Get-PSDrive C} | Select-Object PSComputerName,Used,FreeFree Space: (Get-PSDrive C).FreeOR (in GB) [Math]::Floor(((Get-PSDrive C).Free /[Math]::Pow(2, 30)*10)) /10Used Space: (Get-PSDrive C).UsedOR (Used space in GB's) [Math]::Floor(((Get-PSDrive C).Used /[Math]::Pow(2, 30)*10)) /10Additionally to view total Space: (in GB) $totalSpace = ((Get-PSDrive C).Used + (Get-PSDrive C).Free)/(1024*1024*1024) OR $totalSpace = ((Get-PSDrive C).Used + (Get-PSDrive C).Free)/[Math]::Pow(2, 30)Rounded off values: [Math]::Floor($totalSpace*10) / 10 OR [Math]::Round($totalSpace,1)Querying Motherboard info: wmic baseboard get product,Manufacturer,version,serialnumberQuerying Disk Volume (Of Disk Partitions) Info: Get-Volume returns information about storage drive's partitions, e.g.: Get-Volume # All partitions Get-Volume -DriveLetter C # Specific partition#file system type: Get-Volume -DriveLetter C | select FileSystem (Get-Volume -DriveLetter C).FileSystem#partition size: Get-Volume -DriveLetter C | select Size OR (in GB) [Math]::Floor(((Get-Volume -DriveLetter C).Size/[Math]::Pow(2, 30)*10)) /10Querying Memory / Query RAM Get-WmiObject Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum OR (in GB) $memory = (Get-WmiObject Win32_PhysicalMemory | Measure -Property Capacity -Sum).Sum $memory = [Math]::Floor(($memory/[Math]::Pow(2, 30)*10)) /10 $memory.ToString() + " gb"#Query RAM including Frequency / Speed: Get-CimInstance win32_physicalmemory | Format-Table Manufacturer,Banklabel,Configuredclockspeed,Devicelocator,Capacity,Serialnumber –autosizeAs mentioned, this answer goes bit beyond the question asked, but could be useful for those who'd like additional OS or Hardware information using PowerShell. Skip to main content This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. diskpart
In this article
The diskpart command interpreter helps you manage your computer's drives (disks, partitions, volumes, or virtual hard disks). Before you can use diskpart commands, you must first list, and then select an object to give it focus. After an object has focus, any diskpart commands that you type will act on that object. List available objectsYou can list the available objects and determine an object's number or drive letter by using:
After you run the list commands, an asterisk (*) appears next to the object with focus. Determine focusWhen you select an object, the focus remains on that object until you select a different object. For example, if the focus is set on disk 0 and you select volume 8 on disk 2, the focus shifts from disk 0 to disk 2, volume 8. Some commands automatically change the focus. For example, when you create a new partition, the focus automatically switches to the new partition. You can only give focus to a partition on the selected disk. After a partition has focus, the related volume (if any) also has focus. After a volume has focus, the related disk and partition also have focus if the volume maps to a single specific partition. If this isn't the case, focus on the disk and partition is lost. SyntaxTo start the diskpart command interpreter, at the command prompt type: diskpart <parameter>Important You must be in your local Administrators group, or a group with similar permissions, to run diskpart. ParametersYou can run the following commands from the Diskpart command interpreter:
Additional References
FeedbackSubmit and view feedback for In which of the following Windows locations would you turn off file sharing?Disable Windows File and Print Sharing in Windows 10
Open Control Panel. Click View network status and tasks under Network and Internet. Click Change advanced sharing settings in Network and Sharing Center. Click Turn off file and printer sharing, and click Save changes.
Which command disables a service in the command line?Disable service
Type the following command to disable a service and press Enter: Set-Service -Name "SERVICE-NAME" -Status stopped -StartupType disabled In the command, update "SERVICE-NAME" for the name of the service.
Which of the following should you implement to fix a single security issue on the computer?A patch can fix a single security issue on a computer. A service pack addresses many issues and rewrites many files on a computer; it may be overkill to use a service pack when only a patch is necessary.
Which of the following is one example of verifying new software changes on a test system?Which of the following is one example of verifying new software changes on a test system? C. Patch management is an example of verifying any new changes in software on a test system (or live systems for that matter).
|