Wednesday, January 30, 2013

Slightly Modified Report

Here is a modified Site system roles and servers report that can show all servers:
if @variable != ''
BEGIN
SELECT sys.SiteCode, sys.ServerName,
case when sys.RoleName='SMS Distribution Point'
then case when dp.IsPeerDP=1 then 'SMS Branch Distribution Point'
else 'SMS Standard Distribution Point' end
else RoleName end as 'RoleName'
FROM v_SystemResourceList as sys
left join v_DistributionPointInfo as dp
on sys.NALPath = dp.NALPath
WHERE sys.SiteCode  LIKE @variable
Order by sys.SiteCode, sys.ServerName, RoleName
END
ELSE
BEGIN
SELECT sys.SiteCode, sys.ServerName,
case when sys.RoleName='SMS Distribution Point'
then case when dp.IsPeerDP=1 then 'SMS Branch Distribution Point'
else 'SMS Standard Distribution Point' end
else RoleName end as 'RoleName'
FROM v_SystemResourceList as sys
left join v_DistributionPointInfo as dp
on sys.NALPath = dp.NALPath
--WHERE sys.SiteCode  LIKE @variable
Order by sys.SiteCode, sys.ServerName, RoleName END
To create a modified report, it always helps to build the report in SQL Management Studio. Most of the time, you just need to add 2 lines at the top of the query to accomidate for the SCCM prompt for some reports like the one shown above.

DECLARE @variable varchar(30)
SET @variable = ''
Then you can add whatever information to your variable (in this case called @variable)

Thursday, January 17, 2013

Quick and Dirty Powershell

I didn't want to use psexec and when I tried to use it, I failed my first attempt.

Non-Destructive test to make sure I have the correct syntax:

Get-Content .\SMSReportResults.csv | ForEach-Object {If (test-connection $_ -Count 1 -quiet) {get-childitem \\$_\c$\windows\system32\grouppolicy\machine\registry.pol}}
Destructive command that will delete the registry.pol file which will be recreated next time SCCM checks for updates
Get-Content .\SMSReportResults.csv | ForEach-Object {If (test-connection $_ -Count 1 -quiet) {remove-item \\$_\c$\windows\system32\grouppolicy\machine\registry.pol}}

Quick explanation on what every step does:

  • Get-Content: Reads the lines from file as an array
  • ForEach-Object: Takes the array and does {}
  • If (test-connection $_ -Count 1 -quiet): Quick ping test (1 ping) to see if device is online returns true if online
  • get-childitem: is equivalent to dir or ls
  • remove-item is equivalent to del or rm
Curious to see if there is a way to create a wrapper powershell script that will allow someone used to psexec to use the same context for powershell equivalents.

Friday, January 4, 2013

Poor Man's MRTG on Windows 2008

I'm trying to see what impact the "Configuration Manager 2007 Client Status Reporting" tool may give if it is enabled for 20K+ workstations running from a central site with 2 other primary sites and loads of secondary sites beneath the primaries.  When I came on board, the tool was already configured to ping all inactive clients for the entire site hierarchy without any perceived negative impact.

Once the data is collected don't forget to click on the graph tool
My question and purpose was to figure out if we could enable the policy request from the management points without greatly impacting the environment or if we needed to re-architect the tool to install on each primary site and have the tool only focus on it's own site.  This is the recommended design if you have slow network connectivity between your sites.

Of course slow network connectivity between sites is always subjective and changes over time.  Today a 128k WAN link is slow, whereas it was screaming fast in the 1990s.  What I'm trying to say, is that it always depends on what else is trying to be pushed through your network connection. That means that it is time to measure network bandwidth usage before and after implementation.

I don't have a working relationship with anyone on the networking team, otherwise I would ask someone there to show me the link usage using their reports.  What I really wanted to do was run my own MRTG on just the server to see if I could find out how much more bandwidth this new setting may inflict.  Since MRTG is a perl script and this is on a Windows computer, I wanted to see if I could somehow make Performance Monitor work the same way as MRTG which checks the SNMP settings on routers every 5 minutes by default.

I was lucky and found out that the server already had the SNMP service installed which is necessary in order to monitor the Network Interfaces.  I then created a new Data Collector Set which you can see from the steps that I took below.  I found the Performance tools to watch from the Microsoft site: Monitor and Tune Network Bandwidth and Connectivity

What I like best about this method was that it only took 704 KB to monitor overnight.  This is something you could set to run for 3 days at a time without any concern.

Make sure to choose: Create manually (Advanced)

These options are only available once you install Microsoft's SNMP service

I set the collection interval to 5 minutes which matches MTRG's default

I added a default maximum of 3 day collection