How to use Get-WmiObject's class Win32_Processor with multi processor machines - wmi

In a multi processor machine, what does get-wmiobject -class 'win32_processor' processorId return ?
The docs state
Remarks
On a multiprocessor computer, one instance of the Win32_Processor class exists for each processor.
But where in the command/query you specify which processor to read from ? Does it default to the 1st ? How one queries the 2nd processor (how do you specify which instance of Win32_Processor to query) ?
Here is the output of get-wmiobject -class 'win32_processor'

Related

AppFabric unable to create a DataCache (LMTRepopulationJob FAILS)

Well first of all, I am learning sharepoint 2013 and I have been following a few tutorials, so far I just setup a farm and everything seems to be working properly except for this service that is being logged into the event viewer every 5 minutes:
The Execute method of job definition
Microsoft.Office.Server.UserProfiles.LMTRepopulationJob (ID
1e573155-b7f6-441b-919b-53b2f05770f7) threw an exception. More
information is included below.
Unexpected exception in FeedCacheService.BulkLMTUpdate: Unable to
create a DataCache. SPDistributedCache is probably down..
I found out that this is a job that is configured to execute every 5 minutes
But regarding the assumption that the SPDistributedCache is probably down, I already verified it and it is running
As you can see, it is actually running, also I checked the host cache via SP powershell (get-cachehost and get-cacheclusterhealth) and still all seems fine
Yet when I execute the command get-cache I am getting only the default value, and for what I have read there should be listed another cache types like:
DistributedAccessCache_XXXXXXXXXXXXXXXXXXXXXXXXX
DistributedBouncerCache_XXXXXXXXXXXXXXXXXXXXXXXX
DistributedSearchCache_XXXXXXXXXXXXXXXXXXXXXXXXX
DistributedServerToAppServerAccessTokenCache_XXXXXXX
DistributedViewStateCache_XXXXXXXXXXXXXXXXXXXXXXX
Among others which I think probably should include DataCache
Until now I already tried a few workaround but without success
Restart-Service AppFabricCachingService
Remove-SPDistributedCacheServiceInstance
Add-SPDistributedCacheServiceInstance
Restart-CacheCluster
Even this script that it seems to work on many cases to repair the AppFabric Caching Service
$SPFarm = Get-SPFarm
$cacheClusterName = "SPDistributedCacheCluster_" + $SPFarm.Id.ToString()
$cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local
$cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName);
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername}
$serviceInstance.Delete()
Add-SPDistributedCacheServiceInstance
$cacheClusterInfo.CacheHostsInfoCollection
Well if anyone has any suggestion, I will appreciate very much, thank you in advance!
This is a generic error message, meaning that the real issue isn't known (hence the word "Probably").
I believe that the key to solving this problem when it is not the Probably , is in looking in the ULS log for the events that have occurred just before it. Events of type "Unexpected", do not appear in the events log and are often seen before a generaic type of error.
In many cases you might see something like "File not Found". This usually means that the noted file is not in the assembly cache. Since the distributed Cache utilizes the AppFabric, which is outside of Sharepoint, then the only way for Sharepoint to find it's file, is to look in the assembly cache. The sharepoint pre Installer should have put the files there, but it might have failed or maybe someone uninstalled the App Fabric and re Installed it manually, which would have removed the files from the assembly and not put them back.
Before Restart-CacheCluster you could specify the connection to your SharePoint Database (The catalog name could be not the same)
Use-CacheCluster -ConnectionString "Data Source=(SharePoint DB Server)
\\(Optional Instance);Initial Catalog=CacheClusterConfigurationDB;
Integrated Security=True" -ProviderType System.Data.SqlClient
NOTE: It doesn't work permanently
NOTE 2: If you don't have named instance on DB Server, just put the name of your server without "\".
If you don't have a catalog, you could follow this script
***
Remove-Cache default
New-Cache SharePointCache
Get-CacheConfig SharePointCache
Set-CacheConfig SharePointCache -NotificationsEnabled True
***
New-CacheCluster -Provider System.Data.SqlClient -ConnectionString "Data Source=(SharePoint DB Server)\\(Optional Instance);Initial Catalog=CacheClusterConfigurationDB;Integrated Security=True" -Size Small
Register-CacheHost -Provider System.Data.SqlClient -ConnectionString "Data Source=(SharePoint DB Server)\\(Optional Instance);Initial Catalog=CacheClusterConfigurationDB;Integrated Security=True" -Account "Domain\spservices_account" -CachePort 22233 -ClusterPort 22234 -ArbitrationPort 22235 -ReplicationPort 22236 -HostName [Name_of_your_server]
Add-CacheHost -Provider System.Data.SqlClient -ConnectionString "Data Source=(SharePoint DB Server)\\(Optional Instance);Initial Catalog=CacheClusterConfigurationDB;Integrated Security=True" -Account "Domain\spservices_account"
Add-CacheAdmin -Provider System.Data.SqlClient -ConnectionString "Data Source=(SharePoint DB Server)\\(Optional Instance);Initial Catalog=CacheClusterConfigurationDB;Integrated Security=True"
Use-CacheCluster
You could specify or check your database configuration in regedit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppFabric\V1.0\Configuration
Look for ConnectionString string value, and set your connection string
Data Source=(SharePoint DB Server)\(Optional Instance);Initial Catalog=CacheClusterConfigurationDB;Integrated Security=True
To query the status of the server you could use:
Get-SPServiceInstance | ? {($_.service.tostring()) -eq “SPDistributedCacheService Name=AppFabricCachingService”} | select Server, Status
Get-SPServer | ? {($_.ServiceInstances | % TypeName) -contains "Distributed Cache"} | % Address
Get-AFCache | Format-Table –AutoSize
Get-CacheHost
Aditional:
If you need to change your service account, you could do this procedure:
$f = Get-SPFarm
$svc = $f.Services | ? {$_.Name -eq "AppFabricCachingService"}
$acc = Get-SPManagedAccount -Identity "Domain\spservices_account"
$svc.ProcessIdentity.CurrentIdentityType = "SpecificUser"
$svc.ProcessIdentity.ManagedAccount = $acc
$svc.ProcessIdentity.Update()
$svc.ProcessIdentity.Deploy()
have you changed the distributed cache account from the farm account?
what build number are you on?
is this a single server farm?
off the top of my head, the only thing left is this:
Grant-CacheAllowedClientAccount -Account "domain\ProfileserviceWebAppIdentity"
i would do an iisreset and restart the owstimer service after you run this command.

Install correct video driver based on PNP ID

I am very new at scripting and I need some help. I have an unattended windows XP install that I created. We use two different Nvidia cards, about 50 of each, they use different drivers. I would like to be able to install the correct driver, based on the PNP Device ID. The script below outputs the PNP Device ID, next I want to capture the PNP Device ID and install the correct driver. I just need to be able to read the PNP Device ID, then run a silent install for the correct driver and software. I need to have the full Nvidia software installed, not just the driver. Any help would be greatly appreciated.
Paul
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_VideoController")
For Each objItem in colItems
For Each strCapability in objItem.AcceleratorCapabilities
Wscript.Echo "Accelerator Capability: " & strCapability
Next
Wscript.Echo "PNP Device ID: " & objItem.PNPDeviceID
Next
Const EVENT_SUCCESS = 0
I would recommend using Windows PowerShell for this, instead of VBscript. If you're new to scripting, then I'd suggest that learning PowerShell would be much more advantageous than learning VBscript. You'll be able to do a lot more, with a lot less code.
Let's move on to some code:
# If a video controller matches the string on the right of the -match operator ...
if ((Get-WmiObject -Class Win32_VideoController) -match 'VEN_10DE&DEV_0DFC') {
# ... then run this program
Start-Process -FilePath setup.exe -ArgumentList '/silent /log:"nvidia.log"';
}

WMI Win32_BaseBoard SerialNumber

I used Win32_BaseBoard SerialNumber property to obtain the motherboard serial number and it work most of the time, but sometimes in some computers I get SerialNumber = "Base Board Serial Number" as a result.
Is there a programmatic way to obtain this serial number in a more efficient way or it is simply a manufacturer problem? I have heard that all motherboards come with a serial number with no exception. Is this true?
Whether the Serial Number returned by various WMI queries will be correct or not will depend on the manufacturer of the device. See the answer to this stackoverflow question, Motherboard ID - WMI C++ Reliable? which contains a couple of examples showing that your results can vary.
Some of the variables are whether the equipment is OEM or not and whether the equipment was purchased from a manufacturer who sells to the end customer such as Dell or a manufacturer who sells equipment to resellers who then configure the equipment or if the equipment was assembled from purchased parts.
Those results are processing the properties retrieved by several different WMI queries.
L"SELECT * FROM Win32_SystemEnclosure",
L"SELECT * FROM Win32_BaseBoard",
L"SELECT * FROM Win32_BIOS",
L"SELECT * FROM Win32_ComputerSystem",
L"SELECT * FROM Win32_ComputerSystemProduct",
L"SELECT * FROM Win32_MotherboardDevice",
For instance here is from a point of sale terminal that shows missing serial number information. The intent seems to be that the reseller or dealer or other vendor will provide their own serial number along with other information to basically relabel the terminal.
Connected to ROOT\CIMV2 WMI namespace
Query for SELECT * FROM Win32_SystemEnclosure
SMBIOS SerialNumber: None
SMBIOS Name: System Enclosure
SMBIOS SMBIOSAssetTag: None
SMBIOS Manufacturer: To Be Filled By O.E.M.
Query for SELECT * FROM Win32_BaseBoard
SMBIOS SerialNumber: None
SMBIOS Product: EIN70-SAM
SMBIOS Name: Base Board
SMBIOS Manufacturer: INTEL Corporation
Query for SELECT * FROM Win32_BIOS
SMBIOS SerialNumber: None
SMBIOS Name: BIOS Date: 10/15/13 20:06:15 Ver: 04.06.05
SMBIOS Manufacturer: American Megatrends Inc.
Query for SELECT * FROM Win32_ComputerSystem
SMBIOS Name: GENPOSA-1
SMBIOS Manufacturer: To be filled by O.E.M.
Query for SELECT * FROM Win32_ComputerSystemProduct
SMBIOS Name: EIN70-SAM
SMBIOS IdentifyingNumber: None
SMBIOS UUID: 03000200-0400-0500-0006-000700080009
It is possible that the information is not exposed to WMI. You can confirm this easily using wbemtest.exe (or WMI CIM Studio if you have it installed). On my current computer Win32_BaseBoard.SerialNumber is not null but an empty string. If this is the case you will need to find another way to get this information.
I had a similar problem. You can try out this query and see if it works for you. select UUID from Win32_ComputerSystemProduct

How to / Is it possible to monitor remote WMI scripting?

do u know perhaps a way (via script or program) to find out if e.g. a WMI script runs from a remote PC1 and performs some tasks in another PC2 when I am seating in a third PC: PC3
Assume that all PC belong to the same network and domain and have windows xp installed.
The reason for this that I administer a small network and I think that one student shuts down the PC where another student works, via WMI scripting.
Is there a way to monitor (via script or program) such a thing, without disabling wmi remote access.
Thanks everybody
You can get the credentials used to perform the shutdown by looking at verbose WMI logs.
1) Enable verbose WMI logging
Run 'Wmimgmt.msc' (also available under My Computer > 'Manage' > 'Services and Applications' > 'WMI Control')
Select 'WMI Control (Local)', right click --> select 'Properties'
Select 'Logging' Tab, set 'Logging level' to Verbose
2) Look at the WMI log files (Default location: %WINDIR%\system32\wbemLogs) to see record of remote access and actions taken. Specifically, look at wbemcore.log
Example: When I logged in remotely I saw the following entry [<domain> and <username> here were the real ones used for the remote connection]:
(Thu Aug 13 <time>) : DCOM connection from <domain>\<username>
at authentiction level Packet, AuthnSvc = 9, AuthzSvc = 1, Capabilities = 0
Then, to execute the WMI method the student would need to GetObject Win32_OperatingSystem, which showed up like this:
(Thu Aug 13 <time>): CALL CWbemNamespace::GetObject
BSTR ObjectPath = win32_operatingsystem
long lFlags = 0
And finally you'd look for executing the Win32Shutdown method, which should log something like this:
(Thu Aug 13 <time>) : CALL CWbemNamespace::ExecMethodAsync
BSTR ObjectPath = Win32_OperatingSystem
BSTR MethodName = Win32Shutdown

Get VPN IP address via WMI on Vista

How can we enumerate all the network connections in order to extract the IP address of the VPN connection using WMI? On XP, Win32_NetworkAdapterConfiguration works fine but on Vista it only seems to enumerate the physical connections...
If you look at the comments under the documentation for Win32_NetworkAdapterConfiguration you'll see a reference to Win32_NetworkAdapter when dealing with Vista.
'Vista only code???
Set colAdapters = objWMIService.Execquery ("SELECT * FROM Win32_NetworkAdapter WHERE NetEnabled = True")
For Each nic in colAdapters
msg = "nic.DeviceId: " & nic.DeviceId & vbCRLF _
& "nic.Name: " & nic.Name & vbCRLF _
Next
From this you should be able to retreive the InterfaceIndex and lookup the IP address from the Win32_IP4RouteTable class.
It certainly is a roundabout way of getting the information compared to using Win32_NetworkAdapterConfiguration.
Found it in the MSFT classes! Windows Specific implementation of CIM interface object:
gwmi msft_netIPAddress -Namespace 'root/standardcimv2' | format-list -Property InterfaceAlias,IPAddress