Mark Minasi's Tech Forum
Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment   Page 1 of 2      1   2   Next
jsclmedave

Administrator
Registered:
Posts: 499
Reply with quote  #1 

Once again I am using a New CIM Session so that I can easily check a Windows Server for specific settings.

The most common items needed (here) about a Windows Server to assist with troubleshooting or auditing are as follows.

  • Name
  • FQDN
  • OS
  • Service Pack
  • OS Version
  • Server Domain
  • Server MFG
  • Server Model
  • Server Type
  • Ping IP
  • Reboot Pending
  • If a File Exists 
  • The Files Access Rights
  • A Local Agents Version, Date Installed, Path, Service Name, Start Mode, State, Status, Desktop Interact
  • Port Open
  • Font Cache Service running - This causes issues with the Agent if this is running
  • NIC Name,DNS,IPV4,Suffix,Subnet,GW,WIN and MAC

There have been several cases where the Ping Address did not match the actual IP of the machine which is why I am pulling the IP from different places.


One of the great things about CIM, as Mike Robbins and Jeff Hicks pointed out, is that I can hit all of the Server OS versions at our company including hundreds of WIN 2000 Servers.

So with the same function I can target a list of Servers with an OS from 2000 to 2012 R2.  I cannot stress how important that is here since we have such a large mix of OS.


Note - I do have Local Admin rights on all of the Windows Servers that I am targeting, and they are currently in a single trusted domain...


Once again, Thanks goes out to Jeff Hicks, Mike F Robbins, Richard Siddaway, Adam Bertram and everyone else that worked with me on this...




This part is checking for connectivity to the Target Server and attempting to connect using the DCOM protocol to that Target Server. If there are any issues it will be written to a file located in the Temp Directory of the PC/Server you are running this from.



    [CmdletBinding()]
    param(
        [Parameter(Position=0,
                    ValueFromPipeline=$true,
                    ValueFromPipelineByPropertyName=$true)]
        [ValidateNotNullorEmpty()]
        [string[]]$ComputerName = $env:COMPUTERNAME,
 
        [System.Management.Automation.Credential()]$Credential = [System.Management.Automation.PSCredential]::Empty
    )
 BEGIN {
        $Date = (get-date).ToString('MM-dd-yy-HHmm')
        $Opt = New-CimSessionOption -Protocol Dcom
        $CS = $null
        $SessionParams = @{
            ErrorAction = 'Stop'
        }
        If ($PSBoundParameters['Credential']) {
            $SessionParams.Credential = $Credential
        }
}
#######################################
   


PROCESS {
$ServerInfoReport = @()
ForEach ($Computer in $ComputerName){
# Checking connection to Server If cannot connect drop this server and go to the next one.
Try {
$Check1 = Test-Connection $Computer -Count 1 -ErrorAction Stop | Select-Object Address,IPV4Address
Write-Host 'Test-Connection successful for Server ' $Check1.Address $Check1.IPV4Address -ForegroundColor Yellow
"`r`n"
} # End Try
Catch [System.Net.NetworkInformation.PingException]{
#$ErrorMessage = $Computer + ' [CATCH] ' + $Check1.IPV4Address + ' ' + $_.Exception.Message
$ErrorMessage = "$Computer [CATCH] $($Check1.IPV4Address) $($_.Exception.Message)"
"`r`n"
Write-Warning -Message $ErrorMessage
$ErrorMessage | Out-File "C:\Temp\Get-NEW_ServerInfo_Errors $Date.txt" -Append
#Write-Warning -Message "[CATCH] Unable to connect to $Computer. Verify $Computer is online and try again."
"`r`n"
Start-Sleep -s 5
Continue
} # End Catch
Try {
Write-Host -Message "Attempting to connect to $Computer using the DCOM protocol." -ForegroundColor Yellow
$CS = New-CimSession $Computer -SessionOption $Opt -ErrorAction Stop
} # End Try
Catch [Microsoft.Management.Infrastructure.CimException]{
"`r`n"
#$ErrorMessage = $Computer + ' - ' + $Check1.IPV4Address + ' ' + $_.Exception.Message + '[CATCH] You may not have the proper access to: ' + $Computer + ' - ' + $Check1.IPV4Address
$ErrorMessage = "$Computer $($Check1.IPV4Address) $($_.Exception.Message) [CATCH] You may not have the proper access to: $Computer $($Check1.IPV4Address)"
Write-Warning -Message $ErrorMessage
"`r`n"
$ErrorMessage | Out-File "C:\Temp\Get-NEW_ServerInfo_Errors $Date.txt" -Append
#Write-Warning "[CATCH] You may not have the proper access to $Computer $Check1.IPV4Address"
"`r`n"
Continue
} # End Catch


#########################



The next step is to gather the CIM information that I need.


#########################
# Get CIM INFORMATION
#########################
$FQDN = [System.Net.Dns]::GetHostEntry([string]$Computer).HostName # $FQDN = [System.Net.Dns]::GetHostByName($computer) This was the orig code. Is obsolete. http://stackoverflow.com/questions/12268885/powershell-get-fqdn-hostname
$IPDNS = [System.Net.Dns]::GetHostEntry([string]$Computer).AddressList.IPAddressToString
$PingIPV4Address = Test-Connection $Computer -Count 1 | Select-Object IPV4Address
$OS = Get-CimInstance -CimSession $CS -ClassName Win32_OperatingSystem -Property Caption,CSDVersion,Version,Manufacturer,LastBootUpTime | Select-Object Caption,CSDVersion,Version,Manufacturer,LastBootUpTime
        $OSServicePack = $OS.CSDVersion
        If ($OSServicePack){}Else{$OSServicePack = 'N/A'}
$ComputerSystem = Get-CimInstance -CimSession $CS -ClassName Win32_ComputerSystem -Property Domain,Manufacturer,Model,SystemType | Select-Object Domain,Manufacturer,Model,SystemType
$RACEService = Get-CimInstance -CimSession $CS -ClassName Win32_Service -Filter "Name='RACEsvc'" | Select-Object Name,StartMode,State,Status,DesktopInteract
        $RACEServiceName = $RACEService.Name
        If ($RACEServiceName){}Else{$RACEServiceName = 'N/A'}
            $RACEServiceStartMode = $RACEService.StartMode
            If ($RACEServiceStartMode){}Else{$RACEServiceStartMode = 'N/A'}
                $RACEServiceState = $RACEService.State
                If ($RACEServiceState){}Else{$RACEServiceState = 'N/A'}
                    $RACEServiceStatus = $RACEService.Status
                    If ($RACEServiceStatus){}Else{$RACEServiceStatus = 'N/A'}
                        $RACEServiceDI = $RACEService.DeskTopInteract
                        If ($RACEServiceDI){}Else{$RACEServiceDI = 'N/A'}
$Config = Get-CimInstance -CimSession $CS -ClassName Win32_NetworkAdapterConfiguration -Filter "ipenabled= 'True'"
        $ConfigWINs = $Config.WINSPrimaryServer
        If ($ConfigWINs){}Else{$ConfigWINs = 'N/A'}
#########################
# END GET CIM INFORMATION
#########################



Checking for any Pending Reboots which cause issues with some of our in-house applications.

#########################
# Get Pending Reboot 
#########################
$RPREGcim = Get-CimClass -Namespace root\default -class StdRegProv -CimSession $CS
$RPHKLM=2147483650
    $PRresult = @{
        CBSRebootPending =$false
        WindowsUpdateRebootRequired = $false
        PendingFileRenameOperations = $false
        }
########### CBSRebootPending ############# The Key will not exist unless there is a pending operation.
$CBSRPPath = 'Software\Microsoft\Windows\CurrentVersion\Component Based Servicing'
$CBSRPenumArgs = @{hDefKey=$RPHKLM;sSubKeyName=$CBSRPPath}
    $CBSRPparamHash = @{
        cimclass = $RPREGcim
        CimSession = $CS
        Name = 'EnumKey'
        Arguments = $CBSRPenumArgs
        }
$CBSRP = Invoke-CimMethod @CBSRPparamHash
    If($CBSRP.sNames -contains 'RebootPending')
        {
            $PRResult.CBSRebootPending = $true
        }
########### WindowsUpdateRebootRequired ############# The Key will not exist unless there is a pending operation.
$WURPPath = 'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update'
$WURPenumArgs = @{hDefKey=$RPHKLM;sSubKeyName=$WURPPath}
    $WURPparamHash = @{
        cimclass = $RPREGcim
        CimSession = $CS
        Name = 'EnumKey'
        Arguments = $WURPenumArgs
        }
$WURP = Invoke-CimMethod @WURPparamHash
    If($WURP.sNames -contains 'RebootRequired')
        {
            $PRResult.WindowsUpdateRebootRequired = $true
        }
############ PendingFileRenameOperations ############ The Key will not exist unless there is a pending operation.
$PFROPath = 'SYSTEM\CurrentControlSet\Control\Session Manager'
$PFROenumArgs = @{hDefKey=$RPHKLM;sSubKeyName=$PFROPath}
    $PFROparamHash = @{
        cimclass = $RPREGcim
        CimSession = $CS
        Name = 'EnumValues'
        Arguments = $PFROenumArgs
        }
$PFRO = Invoke-CimMethod @PFROparamHash
    If($PFRO.sNames -contains 'PendingFileRenameOperations' )
        {
            $PRResult.PendingFileRenameOperations = $true
        }
$RebootPending = $PRresult.ContainsValue($true)
#########################
# End Get Pending Reboot 
#########################


I need to ensure that this file, which is similar to a MOF file exists and has the right access inside of it.

#########################
# User.Local File 
#########################
#
# Verifying that the Users.Local file does not have added Admin Access entered. Example: Admins:MarkMinais@Big.Dog.Com rw,map=lennyj
$UserFile = Get-ChildItem -Path \\$Computer\C$\WINNT\rsc\Users.Local, \\$Computer\C$\Windows\rsc\Users.Local -Recurse  -ErrorAction SilentlyContinue | Select-String -Pattern "@r"
    If($UserFile){$UserFileDoc = $UserFile.Line}Else{$UserFileDoc = "Pass"}
#
# Verifying that the User.Local file exists
$Path1 = "\\$Computer\C$\Windows\rsa\Users\Users.Local"
$Path2 = "\\$Computer\C$\WINNT\rsa\Users\Users.Local"
$Path01 = Test-Path -Path $Path1
$Path02 = Test-Path -Path $Path2
    If($Path01 -eq "False" -and -$Path02 -eq "False"){$UserFileTest = "User.Local Not Found"}Else{$UserFileTest = "Pass"}
#
#########################
# End Users.Local File
#########################


I need to check for this Service.  If it is running is causes issues with some of our in-house applications.

#########################
# Check FontCache 
#########################
    If(!(Get-CimInstance -CimSession $CS -ClassName Win32_Service -Filter "DisplayName='FontCache'"))
        {
            $FontCache = 'Not Running'
        } 
            Else {$FontCache = 'Is An Issue!'}
#########################
# END Check FontCache 
#########################



Next a simple Port Check - Thanks to Adam Bertram for this bit.

#########################
# Check TCP PORT
#########################
$Timeout = 1000 # Timeout 
$TcpPort = 4852 # Port to check
## Create the TcpClient Object and initiate a Connect method
$Socket = New-Object System.Net.Sockets.TcpClient
$iar = $Socket.BeginConnect($Computer,$TcpPort,$null,$null)
$Wait = $iar.AsyncWaitHandle.WaitOne($Timeout,$false)
    If(!$Wait) 
        {
        $PortStatus = 'Port: 4852 Closed/Filtered on ' + $Computer 
         ## Properly close the TCP connection once we're done
         $Socket.Close()
        }
            Else {$PortStatus = 'Port: 4852 is Open on ' + $Computer
            ## Properly close the TCP connection once we're done
            $Socket.Close()
            }
#########################
# End Check TCP PORT
#########################



The Registry pull is similar to the previous posts so will not re-post it here.


Creating my new customs object with the information I need.

#########################
# Results Custom Object
#########################
    
    $ServerInfoResults = [PSCustomObject]@{
           'Computer' = $Computer
           'FQDN' = $FQDN
           'Operating System' = $OS.Caption
           'OS Service Pack'= $OSServicePack
           'OS Version' = $OS.Version
           'Server Domain' = $ComputerSystem.Domain
           'Server MFG' = $ComputerSystem.Manufacturer
           'Server Model' = $ComputerSystem.Model
           'Server Type' = $ComputerSystem.SystemType
           'PING IP' = $PingIPV4Address.IPV4Address
           'Reboot Pending' = $RebootPending
           'User.Local Exist' = $UserFileTest
           'User.Local Access' = ($UserFileDoc -Join ',')
           'RACE Agent VER' = $RACEVer
           'RACE Agent Date' = $RACEDate
           'RACE Agent Path' = $RACEPath
           'RACE SVC Name' = $RACEServiceName
           'RACE SVC StartMode ' = $RACEServiceStartMode
           'RACE SVC State' = $RACEServiceState
           'RACE SVC Status' = $RACEServiceStatus
           'RACE SVC Desktop Interact' = $RACEServiceDI
           'Port Status' = $PortStatus
           'Font Cache Service' = $FontCache
           'NIC Name' = ($Config.PSComputerName -Join ',')
           'IP DNS' = $IPDNS
           'NIC IPV4' = ($Config.IPAddress -join ',')
           'DNS Suffix' = ($Config.DNSServerSearchOrder -join ',')
           'NIC Subnet' = ($Config.IPSubnet -join ',')
           'NIC Gateway' = ($Config.DefaultIPGateway -join ',') 
           'NIC WINS' = ($ConfigWINs -join ',')
           'NIC MAC' = $Config.MACAddress -Join ','
    }
"`r`n" 
$ServerInfoReport += $ServerInfoResults
"`r`n" 
$ServerInfoReport
#########################
# END Report Results
#########################


And finally cleaning up the CIM Session for each Server.

#########################
# Clean Up At The End        
#########################
    If($CS){
        Get-CimSession | Remove-CimSession
        $CS.Close()
        $CS = $null
    }
    
    Else{
    Write-Host 'No CIM SESSION FOUND'
    }
      } # End ForEach Computer
        
   } # End Process
End{}
 } # End Function


To run the function and save the information to a CSV I would simply run this.

Get-ServerInfo -ComputerName <SserverName> | Export-CSV "C:\Temp\NEW_ServerInfoReport.CSV" -NoTypeInformation


And that's it...


I have attached the entire PowerShell script as a TXT file.  Get-ServerInfo 

txt Get-ServerInfo.txt     

Again Thanks goes out to Jeff Hicks, Mike F Robbins, Richard Siddaway, Adam Bertram.



__________________
Tim Bolton @jsclmedave
Email: [string](0..20|%{[char][int](32+('527377347976847978324785847679797514357977').substring(($_*2),2))}) -replace ' '  

New to the forum? Please Read this
0
JeffHicks

Avatar / Picture

New Friend (or an Old Friend who Built a New Account)
Registered:
Posts: 35
Reply with quote  #2 
I always encourage people not to use + to build strings.  The + operator is for addition.

This:

$ErrorMessage = $Computer + '  [CATCH]  ' + $Check1.IPV4Address + ' ' + $_.Exception.Message

is what we did in the days of VBScript. Learn to use subexpressions:

$ErrorMessage = "$Computer   [CATCH]  $($Check1.IPV4Address) $($_.Exception.Message)"

or the -F operator:

$ErrorMessage = "{0} [CATCH] {1} {2}" -f $Computer, $Check1.IPV4Address,$_.Exception.Message

In my opinion, these are examples of "better" PowerShell.
 



__________________
Jeff Hicks Author ~ Trainer ~ Guru
Cloud and Datacenter Management MVP



0
jsclmedave

Administrator
Registered:
Posts: 499
Reply with quote  #3 
Thanks for the advice Jeff!

I updated the TXT file and the Code above.  I left the old code (# commented out) so that people can see the wrong way to do this compared to what you recommended.

__________________
Tim Bolton @jsclmedave
Email: [string](0..20|%{[char][int](32+('527377347976847978324785847679797514357977').substring(($_*2),2))}) -replace ' '  

New to the forum? Please Read this
0
Mark

Hacked Mark's Facebook Account
Registered:
Posts: 273
Reply with quote  #4 
Hi Jeffrey --

Tell me why you don't like + for string concatenation.  

"Hello there, " + $name + ", thanks for dropping by!"

Seems pretty transparent to me.  Unless you mean this:

"Hello there, $name, thanks for dropping by!"

That does seem better, although I run into cases where it doesn't really work, as when it's not a variable, but a result like a property that IS a string but that doesn't get expanded properly by the double quotes.

And what's the -F operator?  Never ran into that.  I'll have to look it up.  Thanks!

Mark

__________________
May I ask that everyone please populate the first name and last name in your user account profile.  Thanks!
0
JeffHicks

Avatar / Picture

New Friend (or an Old Friend who Built a New Account)
Registered:
Posts: 35
Reply with quote  #5 
I think using + for concatenation is a VBScript paradigm and not a PowerShell paradigm. I think creating strings using + is a bit more error prone  and time consuming to get spacing right or to remember all the quotes.  Understanding how PowerShell expands variables is an important PowerShell skill. Once you understand creating simple strings, often with subexpressions, like this without concatenation then you are read to move on to other PowerShell techniques like Here-Strings.

The -F operator is from .NET but it is described in about_operators. It is basically a find and replace mechanism with formatting options.  It is very useful if you are building text messages for logging.

__________________
Jeff Hicks Author ~ Trainer ~ Guru
Cloud and Datacenter Management MVP



0
Mark

Hacked Mark's Facebook Account
Registered:
Posts: 273
Reply with quote  #6 
Jeff, I agree about the variable expansion, but again I've run into cases on some things where a dot-object doesn't work, as in

"I found $thing.property in $thing"

Where the $thing.object doesn't work.  Dunno why, but it happens sometimes.

And forgive me, but were you suggesting -F as a concatenation tool?  The ref from the About article offers this example:

C:\PS> "{0} {1,-10} {2:N}" -f 1,"hello",[math]:[tongue]i
1 hello 3.14

With respect, "EEEEEEK!"  Looks like the FORMAT statements I used to have to use with FORTRAN back when Eisenhower was president.  I'm not being snarky here, I'm just saying that there is a long, long trek between doing gwmi win32_bios and decoding the -F stuff.  Don't get me wrong, I am genuinely interested in your perspective here, and I kinda think that telling people to get good with -F before they're publicly pilloried for using "+" seems like a BAD thing, no?

Thanks for the feedback.





__________________
May I ask that everyone please populate the first name and last name in your user account profile.  Thanks!
0
JeffHicks

Avatar / Picture

New Friend (or an Old Friend who Built a New Account)
Registered:
Posts: 35
Reply with quote  #7 
I'm betting the problems you have with variable expansion could be solved with subexpressions. Simple variables like this work just fine:

$n = "Mark"
$msg = "I can't do that, $n"

When you look at $msg you get: I can't do that, Mark

But this will fail:
 $s = get-service bits
 $msg = "The $s.name status is $s.status"

When you look at msg it looks like this:

The System.ServiceProcess.ServiceController.name status is System.ServiceProcess.ServiceController.status

I'm assuming this is the type of problem you are referring to. This is where you need to use a subexpression which simply means wrapping the variable name in $().

$msg = "The $($s.name) status is $($s.status)"

The way I explain it is that PowerShell gets what is inside the () first, e.g. $s.name and then treats that as a variable that is more or less created on the fly. There may be a better more technical programming explanation, but most people seem to understand this.  When I see code like this in a script it tells me the author understands the PowerShell paradigm.

As for the -f operator, I totally get your point. And this is a .NET thing primarily for building strings.  Normally in PowerShell we're working with objects so there's no need for this. Unless you need to build some sort of message say for a log file or information for the user.

Here are three ways to define the same message:

$n = "Mark"
$svc = get-service bits
$msg1 = "[$(Get-Date)] $n, the $($svc.name.ToUpper()) service is currently $($svc.status)."
$msg2 = "[{0}] {1}, the {2} service is currently {3}." -f (Get-Date),$n,$svc.name.ToUpper(),$svc.Status
$msg3 = "[" + (Get-Date) + "] " + $n + ", the " + $svc.name.ToUpper() + " service is currently " + $svc.status + "."



You decide which one is easier to write and which is easier to understand without any additional comments. Personally, I find the first method is the fastest to work and easiest to read. The last method with concatenation took the longest to type and I find the + symbols distracting.  All are perfectly valid, but if you want to show that you understand PowerShell I think some techniques are better than others.

__________________
Jeff Hicks Author ~ Trainer ~ Guru
Cloud and Datacenter Management MVP



0
Infradeploy

Avatar / Picture

Senior Member
Registered:
Posts: 179
Reply with quote  #8 
For me i tend to use the parentheses a lot to make sure the string is exactly as i want it .
$enemy = "Dave"
"Just what do you think you are doing, $($enemy)?"

__________________
Have SpaceSuit, Will Travel

0
JeffHicks

Avatar / Picture

New Friend (or an Old Friend who Built a New Account)
Registered:
Posts: 35
Reply with quote  #9 
Sure. That works just as well and if you always do that, you'll never have to worry.

$enemy = "Dave"
$cs = Get-Ciminstance win32_operatingsystem
"[$(Get-Date)] Just what do you think you are doing, $($enemy)?. $($cs.caption) can't do that!"

__________________
Jeff Hicks Author ~ Trainer ~ Guru
Cloud and Datacenter Management MVP



0
jsclmedave

Administrator
Registered:
Posts: 499
Reply with quote  #10 
What about this Jeff.  Is there a reason to use or not use this?


I use it currently for bodies of email messages...

@"


[$(Get-Date)]


Just what do you think you are doing, $($enemy)?.


$($cs.caption) can't do that!


"@





__________________
Tim Bolton @jsclmedave
Email: [string](0..20|%{[char][int](32+('527377347976847978324785847679797514357977').substring(($_*2),2))}) -replace ' '  

New to the forum? Please Read this
0
JeffHicks

Avatar / Picture

New Friend (or an Old Friend who Built a New Account)
Registered:
Posts: 35
Reply with quote  #11 
That's a Here-String which is a related type of construct.  If you wanted to create the same result but with concatenation it would be ugly. So yeah, if you start using variable expansion and substrings, it's just another easy step to go to a multi-line here string if you need that.  Just a matter if you want a single line or multiple.
__________________
Jeff Hicks Author ~ Trainer ~ Guru
Cloud and Datacenter Management MVP



0
Mark

Hacked Mark's Facebook Account
Registered:
Posts: 273
Reply with quote  #12 
Thanks, Jeff, I got that... my point was that (and perhaps I'm wrong) I really, really don't want to create barriers to attracting casual PoSHers to become more heavy-duty PoSHers.  

Again, forgive me, but the -F thing is freakin' ugly, and telling noobs that they ought to be using it might make them Mac admins. :-) 

It LOOKS powerful, but two minute's examination of it didn't clarify anything (for me) and so it goes in the "one of these days I'll see Hicks talk about it" category which, again, is cool -- I love obscure magic scripting-wise -- I just don't want newcomers to feel like they're somehow "not of the Body" if they don't use it.

__________________
May I ask that everyone please populate the first name and last name in your user account profile.  Thanks!
0
JeffHicks

Avatar / Picture

New Friend (or an Old Friend who Built a New Account)
Registered:
Posts: 35
Reply with quote  #13 
You're making too much of the -F operator. I was merely pointing it out as another alternative to concatenation. The best alternative is to understand how to use variable expansion and subexpressions.
__________________
Jeff Hicks Author ~ Trainer ~ Guru
Cloud and Datacenter Management MVP



0
Mark

Hacked Mark's Facebook Account
Registered:
Posts: 273
Reply with quote  #14 
Forgive me, Jeff, I wasn't being dilatory.

The -F reference was because it seemed that you were offering Tim prescriptive style advice.  

I'm always interested to hear that sort of thing from PowerShell heavy hitters like you, as I try to make notes on that and form habits that adhere to it and so I can nudge my students in that direction.

It is still the case, however, that Job One is "get something working," and Job Two -- a very close second -- is Make It Readable, and that's where your style advice arises from.  Variable expansion I'm all over.  I only learned it two years ago but it quickly became something usually remember, and I agree that it DOES make for more readable code.

That said, styles arise out of opinions, and I frankly couldn't understand why anyone would use -F except in a case of absolute need.  I was just trying to find out why you thought that way.

I hope that clarifies my question -- again, I was puzzled, not trying to be a jerk.

Thanks!  (Or perhaps I should say, "CURSES!," as I now will have to find the time to figure the whole thing out. [smile] )

__________________
May I ask that everyone please populate the first name and last name in your user account profile.  Thanks!
0
jsclmedave

Administrator
Registered:
Posts: 499
Reply with quote  #15 
So besides all of that,,, did you like the script?  [smile]

A couple of things drove me in the direction I went.

  1. WSMAN protocol will not work in our environment for 2012 R2 Servers and 50/50 on 2008 R2 which is why I force the DCOM protocol which has been spot on.
  2. We have a mix of 2000 - 2012 R2 so some commands that will work in 2012 R2 obviously will not on the 2000 OS.  The CIM cmdlets works on them all and I am now looking into other appliances where I can leverage CIM including our Linux Servers.
  3. I have noticed that CIM is FAST!  I may have been doing something wrong with my WMI commands but using CIM I get info back in seconds rather than minutes.  So fast in fact I thought I was doing something wrong...
  4. Why did I not target an OU?  Because our current OU structure is a -F disaster!  We are working on getting it under control but that is going to be a project on its own.

I just used the same method to locate specific driver values for VMWare Tools indicating a feature setting is in use which we have to identify as soon as possible.

150 Servers - I had access to 135 - just over 100 have the setting we need to address - results exported to a CSV for the VM Team = 1 Minute 36 Seconds...  

Not bad...

__________________
Tim Bolton @jsclmedave
Email: [string](0..20|%{[char][int](32+('527377347976847978324785847679797514357977').substring(($_*2),2))}) -replace ' '  

New to the forum? Please Read this
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.