Display: Cloud | List
Most Popular Tags
Results (9 total) All > win32_computersystem (x)
Rename Computer using WMI - Sample in PowerShell (WMI Tasks: Accounts and Domains (Windows))
<#.SYNOPSIS This script renames a computer using WMI..DESCRIPTION This script uses the Rename method from Win32_OperatingSystem WMI class. This is sample 5 from http://msdn.microsoft.com/en-us/library/aa394586.NOTES File Name : Set-ComputerName.ps1 Author : Thomas Lee - tfl@psp.co.uk Requires : PowerShell Version 2.0.LINK This script posted to: http://www.
Last modified by Thomas Lee on 9/25/2011 7:03:57 PM
C++ code example for Rename method (Rename method of the Win32_ComputerSystem class (Windows))
Attach my c++ code, it's kind of a combination of http://msdn.microsoft.com/en-us/library/aa390423(VS.85).aspx and http://msdn.microsoft.com/en-us/library/aa390421(VS.85).aspxint set_computer_name(const string &newname/*, const string &username, const string &password*/){ HRESULT hres; // Step 1: -------------------------------------------------- // Initialize COM. ---------
Last modified by hilong on 12/2/2009 1:56:46 AM
Getting Logged on User using WMI and PowerShell (WMI Tasks: Accounts and Domains (Windows))
# Get-LoggedOnUser.ps1 # Uses Win32_Computer System to the logged on user(s) # Sample 4 from http://msdn.microsoft.com/en-us/library/aa394586 # Thomas Lee - tfl@psp.co.uk # Format messed up by MSDN Edit Tool :-( # Get details of this computer $computers = Get-WmiObject -Class Win32_ComputerSystem # Get Logged on User(s) "Logged on user(s):" foreach($computer in $computers) {
Last modified by Thomas Lee on 6/14/2009 11:35:20 AM
<#.SYNOPSIS Demonstrates uptime using WMI .DESCRIPTION This script used Win32_ComputerSystem to determine how long your system has been running. This is a rewrite of sample 3 at http://msdn.microsoft.com/en-us/library/aa394591(VS.85).aspx. .NOTES File Name : Get-UpTime.ps1 Author : Thomas Lee - tfl@psp.co.uk Requires : PowerShell V2 CTP3.LINK Script Posted to: http://w
Last modified by Thomas Lee on 1/13/2009 10:32:54 AM
Sample 4 - Get Processor count using PowerShell (WMI Tasks: Computer Hardware (Windows))
# Get-Processor.ps1 # Sample 4 on http://msdn.microsoft.com/en-us/library/aa394587(VS.85).aspx # Gets the number of processors on the local system # NB: processors includes all cores on mult-cores ystems # Thomas Lee - tfl@psp.co.uk # Get system information $system = Get-WmiObject -Class Win32_ComputerSystem # Display processor count "System Name : {0}" -f $system.Name "Number of Processo
Last modified by Thomas Lee on 12/7/2008 12:04:05 AM
Sample 3 - Get Physical RAM using PowerShell (WMI Tasks: Computer Hardware (Windows))
# Get-PhysicalRAM.ps1# Sample using PowerShell# 3rd sample from http://msdn.microsoft.com/en-us/library/aa394587 # Get Physical RAM# Thomas Lee $mem = Get-WmiObject -Class Win32_ComputerSystem # Display memory"This system has {0} MB Free Memory" -f $($mem.TotalPhysicalMemory/1mb) This script produces the following output: PS C:\foo> .\get-physicalramThis system has 8188.7421875 MB Free Mem
Last modified by Thomas Lee on 12/7/2008 12:03:39 AM
DetermineDomainRole.ps1 using WMI and PowerShell (WMI Tasks: Accounts and Domains (Windows))
# Get-DomainRole.ps1 # Gets system's domain role using PowerShell # Sample 2 from http://msdn.microsoft.com/en-us/library/aa394586# Thomas Lee - tfl@psp.co.uk# Get Computer info$Computer = Get-WmiObject - Class Win32_ComputerSystem # Print Role:"Computer `"{0}.{1}`" is a: "-f $Computer.Name,$computer.domain switch ($computer.DomainRole) { 0 {"Standalone Workstation"}1 {"Member Workstation"}
Last modified by Thomas Lee on 6/14/2009 11:39:42 AM
Get ComputerName using WMI and PowerShell (WMI Tasks: Accounts and Domains (Windows))
# Get-ComputerName.ps1 # Gets system's computer name using PowerShell # Sample 3 from http://msdn.microsoft.com/en-us/library/aa394586 # Thomas Lee - tfl@psp.co.uk# Get Computer info$Computer = Get-WmiObject -Class Win32_ComputerSystem # Print Computer Name"Computer Name is: {0}" -f $Computer.Name This script produces the following output PS C:\foo> .\Get-ComputerName.ps1 Compute
Last modified by Thomas Lee on 11/22/2008 1:20:18 PM
Determine-Domain using WMI and PowerShell (WMI Tasks: Accounts and Domains (Windows))
# Determine-Domain.ps1 # Uses Win32_ComputerSystem to determine the domain this computer is in# Sample 1 from http://msdn.microsoft.com/en-us/library/aa394586 # Thomas Lee - tfl@psp.co.uk # Get details of this computer $computer = Get-WmiObject -Class Win32_ComputerSystem # Display details "System Name: {0}" -f $computer.name "Domain : {0}" -f $computer.domain This script produced
Last modified by Thomas Lee on 9/25/2011 3:08:23 PM
Page view tracker