Skip to main content

Posts

Showing posts with the label WMIC

Get display resolution from the command line

Get display resolution from the command line This will get both local resolution and remote desktop screen resolution using WMIC. c:\>wmic path Win32_VideoController get VideoModeDescription Sample out below when run on remote desktop session VideoModeDescription 1024 x 768 x 4294967296 colors 1912 x 989 x 4294967296 colors Tags: WMIC screen resolution

PowerShell Quick Tips: Rename a computer

Rename local computer to W8M1 and restart PS D:\> Rename-Computer -NewName W8M1 -Restart The above command works with Powershell 3.0. For Powershell 2.0, below can be used on an elevated privileges. PS D:\> $computer = Get-WmiObject Win32_ComputerSystem -ComputerName <old_name> PS D:\> $computer.Rename("<new_name>") PS D:\> $os = Get-WmiObject Win32_OperatingSystem PS D:\> $os.psbase.Scope.Options.EnablePrivileges = $true PS D:\> $os.Reboot() Using WMIC to rename a computer D:\> WMIC ComputerSystem where Name="%computername%" call Rename Name=NewName References: http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/c9dcf26a-5476-4199-8311-b101c969a47a/ http://blogs.technet.com/b/askds/archive/2009/02/19/renaming-a-computer-using-wmic-and-how-to-get-around-that-aggravating-invalid-global-switch-error.aspx