Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Setup the context information
- $mContext = New-Object System.Management.ManagementNamedValueCollection
- $mContext.Add( "__ProviderArchitecture", 64)
- $mContext.Add( "__RequiredArchitecture", $true)
- # Setup the Authrntification object
- $ConOptions = New-Object System.Management.ConnectionOptions
- #$ConOptions.Username = "computernameadministrateur" # Should be used for remote access
- #$ConOptions.Password = "toto"
- $ConOptions.EnablePrivileges = $true
- $ConOptions.Impersonation = "Impersonate"
- $ConOptions.Authentication = "Default"
- $ConOptions.Context = $mContext
- # Setup the management scope (change with the computer name for remote access)
- $mScope = New-Object System.Management.ManagementScope( `
- "\localhostrootcimV2", $ConOptions)
- $mScope.Connect()
- # Query
- $queryString = "SELECT * From Win32_PerfFormattedData_NETFramework_NETCLRMemory"
- $oQuery = New-Object System.Management.ObjectQuery ($queryString)
- $oSearcher = New-Object System.Management.ManagementObjectSearcher ($mScope, $oQuery)
- $oResult = $oSearcher.Get();
- $oResult.Name # only for simple check that current code snippet gives
- # the same results from both 32 and 64 -bit version of PowerShell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement