Showing posts with label services. Show all posts
Showing posts with label services. Show all posts

Tuesday, September 27, 2011

Querying Services on Remote Computers

I'm still amazed that so many up-and-coming admins and SE's knee-jerk to using a script to perform a task that is readily available from a command prompt.  In this case, the SC command.  The SC.exe command resides in the %WINDIR%\System32 folder on most Windows XP, Vista and Windows 7 systems (as well as Windows Server 2003, 2008 and 2008 R2).  It's also alive an well on Windows 8 (Dev Preview build, anyway), and I presume resting within Windows Server 8 as well (I haven't seen it yet).

The syntax is rather basic:

sc <server> <option> <parameters>

but most people use it for querying the local services state, as follows:

sc query

The flexibility comes with the "<server>" argument, which is the NetBIOS computer name (with preceeding \\), so to query a remote computer named DESKTOP1 over your network...

sc \\DESKTOP1 query

And just add a piped "| more" to pause screen-by-screen (or redirect into a file, etc.)

One short and simple command, instead of a bunch of VBScript or even a lengthy Powershell cmdlet.  Nothing wrong with those options, but it's nice to know there are other alternatives.

Remember: To break open this little nugget, open a CMD console and type "sc /?", press Enter and enjoy!

10 Ways to Manage Windows Services

  1. Services Console (services.msc)
  2. Command Line: sc.exe
  3. WMI / COM Script: VBscript, KiXtart, Javascript, Perl, etc.
  4. .NET Script: PowerShell
  5. WMI Class Provider: Win32_Service
  6. Group Policy Object
  7. Group Policy Preferences
  8. Utilities: PSService.exe (Sysinternals/Microsoft)
  9. .MSI installer
  10. .EXE application or installer

Monday, September 26, 2011

Automation Gyration

I recently updated some information on my tabular matrix of "Windows 7 Automation Options" over at my other other other web site.  The goal of this matrix is to map out alternative ways to perform common administrative tasks and compare which is best for certain conditions or situations.  Let me know if you want something added or if you have a correction to offer.

Monday, August 29, 2011

FLEXlm and your IT Department

I really wish more people using FLEXlm would at least sit down and talk with their IT department and act like a "team".  You know: Act like they work for the same damn company.  One of the most common mistakes I've seen is when the CAD group and the IT department develop an animosity towards each other, and any hope of cooperative planning and execution is pretty much destroyed.  It puts the company in the position of setting the baby in the street waiting for a truck to come along and run it over.

When you involve your IT department, you gain the advantages of expanded resources, greater oversight, and better fault tolerance.  I mean REAL fault tolerance.  One example is backups, especially backing up the FLEXlm license files, but also option files, service configurations, and so on.  More than that, you gain the advantages of putting the entire server into a virtual environment (Hyper-V or vSphere, for example).  One of the most common risk scenarios I've seen is running all your licenses on ONE physical server.  Even two physical servers is not a good idea.  Sure, it works.  But when it fails, it means a lot of unnecessary work ahead of you.

When servers are virtualized properly (e.g. distributed, SANs, failover, etc.) you make your license availabilty resilient.  That word has been overused and burned out by marketing pukes after a few too many Martinis and golf course sunburns, but the word has a real meaning to IT architects and engineers.  It means that your systems can bounce back from potential failure.  When all licenses are on one physical server, not only are you facing the task of rebuilding a failed box, but reinstalling the licenses and dealing with hardware changes (i.e. a failed NIC or hard drive).  In the virtual world those things remain portable and tied to the virtual guest.  But WAAAAAAAAY more important than that is the ability to use VMotion or Live Migration, which automatically, and seamlessly moves a virtual guest to a different physical host node when problems occur.

Most small engineering shops don't often bother with network licensing, so it's usually medium to large shops that have a real "IT department".  If you have "servers", hopefully some are "virtual" (if none of your servers are virtual, it may be time to have a discussion with your IT staff), and if you have virtual servers, you should be considering that approach for your FLEXlm servers.

Sunday, January 2, 2011

When 1 + 1 = 0

Once upon a time (uh oh, here goes another fairy-ish tale beginning?), there was a state government who, in their quest to cut expenses, decided it was time to outsource their IT operations to a commerical contractor.  Everything about it made sense to the financial folks, who, after all are the brains behind most corporate/government braintrusts.  The reduced benefits structuring costs, the eliminated pensions, the laisse faire employment tenants, all combined with an existing "work-at-will" legal framework, made it a no-brainer.  So the wheels were set in motion.

But there were two major problems this created, which led to yet more problems.

First, the financial golf-player suit guys didn't think it was necessary to involve the IT management folks in their decision-making process.  Technical folks obviously do not possess any useful wisdom for making decisions that impact technical operations.  That domain belongs to the MBA/CPA folks.  So they marched onward and when the plan was catalyzed into full momentum, they generously informed their propellor-capped brethren of their wonderous idea.  The net result of this was a mass exodus of those that were either ready to retired, or possessed the skills and experience to land another job quickly.  The life rafts were left with the lesser skilled and unlucky.  Floating adrift in a void economy as they watched their ship of achievements slowly sink below the rough seas.

Second, with the turmoil of the markets of the time (2007-2008), the chosen contractor was dealing with their own contractions in the Washington D.C. metro area.  Contracts were drying up faster than Joan Rivers' vagina in the desert, and jobs were being cut at a dizzying pace.  Ok, maybe that wasn't nice to say about Joan, but she's not known for being nice to anyone, is she?  And besides: they have medication for that now I'm told.  Ok, moving along…   So, when the last bastion of workforce in the DC area was staring into the abyss, they were calmly told to consider jumping onto the impending state IT contract, or close their eyes and jump, hoping for the best.  Again, those that had the skills and experience to market themselves were off to greener pastures.  The rest were left to consider relocation or sucking on the end of a double-barrel vacation.

The vortex this spun created a combination of the left-behind and the left-behind.  Those motivated by fear with those motivated by fear.  You get the picture.  What sort of "quality" meal might anyone with even an eighth of a functional brain expect to see from such ingredients?  Well, you get this.

To be fair, it's incorrect, inaccurate and illogical to extend the blame of this on other parts of either of these institutions.  The storm is relatively focused and distinct.  It resides in Richmond.  Unfortunately, the ship captains have not yet realized the detrimental impacts this boondoggle has had on their respective marketing efforts.  Their credibility is being picked apart by their competitors, the media, and to some extent the public.  For example, even today (January 2, 1011) the Virginia Dept of Motor Vehicles (DMV) web site is out of commission, as it has been for quite some time.  The reduction in DMV brick-and-mortar locations was pushed by the demand for cost reductions and increased leverage of online services.  Now that these online services are offline, and there are fewer physical locations across the state, the net result is an ugly day at work for many DMV workers.

So, I ask that - whether you are yourself a financial MBA/CPA golfer suit wearing person, or if you know one, that you print out several copies of this article, roll them up into a tight bundled tube, encase it with several turns of duct tape, grip it tightly and beat the living shit out of anyone who says the word "outsource" in a positive tone.  Be sure to follow that up with "and a Happy New Year to you!"

Thursday, December 9, 2010

Old Topic / New Thoughts: Special User Accounts

You have scheduled tasks and services running around like 3-legged blind cats with collars made of catnip.  They've been drinking Red Bull all day also.  Not good.  Now one of the suits walks in with a folded up magazine about "Cutting Edge IT" he lifted from the seat pocket on his red-eye flight from Vegas.  He says: "You boyz, listen up! I read that you best be a-changin them there passwords on them there service accounts.  Y'all hear?!"  And after a short pause with no sound, you all start back to work as if he never entered the room.

Ok, I needed a mental break.  On to something more serious:

You changed a password and now shit is breaking.  Or even more tedious is that the account keeps getting locked because something out there in the depths of space is still trying to use it and getting the gas-face from AD.  You could start the manhunt for where the problems are coming from.  You can query AD for which DC handled the offending request that locked the account.  You can query all computers in the Forest or Domain for scheduled tasks, services, DSNs, auto-runs, and so on.  Fear not there are three easy "options" to mitigate this crap:

1. Create a new account.  Disable the old account

2. Restrict the account to only specific computers

3. Use machine accounts (aka "SYSTEM")

I prefer option 3 for everything.  Like killing ants with a Gatling-style howitzer.  But that's just me.  As for option 1, it'll leave a mess behind, that's for sure.  But the problem will eventually be solved.  However, it will only work its way out if you combine it with option 2.

Option 2 is really what you should have been doing all along.  A funny little trick we used to do waaaay back to **** with co-workers was to get on our computers in the morning, and enter the user ID for the co-worker and fat-finger the password (intentionally) enough times to lock the account.  Then chuckle, sip some coffee and log in normally and wait for the yelling from across the room.  Good times. 

Funny: maybe (to me it was), but this is actually a serious problem.  A very serious problem. It means with a casual query of AD (very simple for any user to do) I can guess some of the critical account names and intentially lock them and disrupt business processes.  This is kind of like that guy in the new All State commercials with the band-aid on his face going around causing problems like Mr. Murphy himself.  Option 2 above helps mitigate this vulnerability from being exploited and hitting your sensitive operations accounts.

Option 3 not only mitigates a sneaky prank attack like that described above, but it also removes the need to monkey with stupid passwords.  I mean - seriously - this is 2010 and we're STILL having to stop everything to change passwords - modify scheduled jobs - edit config files and DSN's - fix Dr. Asswipe's PHd hard-coded stupid-ass application (the guy in accounting who insists on writing his own apps and smokes a pipe, you know the guy), and STILL get any work done?  Seriously?!  We've gone NOWHERE.  Our forefathers would be crying in their colonial beer mugs.

Tuesday, November 16, 2010

The Cloud

I was asked by several folks what I thought about "the cloud" and what it means for the future of IT, business, culture, society, and so on.  One reader (Randy, thank you!) asked if I would take a minute to write something on it.  I've been poking at this subject with a stick like a three year old curiously prodding a jelly fish washed ashore.

First: Caveats and Disclaimers:  I don't work with cloud technologies.  I don't have any clients that use what I would call "significant" cloud services.

The closest thing to cloud services I've used is Gmail, Google Docs, Google Calendar, Picasa, Flickr, Facebook, Twitter and Blogger.  Some of these only remotely qualify as a "cloud" service, while others fit the bill pretty well (Gmail and Google Docs, for example).

But what is it?

Wikipedia (everybody's authoritative source, right?  heh heh) defines it as "Cloud computing is Internet-based computing, whereby shared resources, software and information are provided to computers and other devices on-demand, like electricity"

That's better, but it still doesn't make it crystal clear to a lot of people.  This is like many IT terms which those working inside the club have an inate, yet unwritten understanding of.

To me, a cloud service is when you rely on something hosted over the Internet that you would have traditionally relied on from within your own facilities.  E-mail, document management, CRM, timekeeping, HRIS, accounting, finance, contracts, payroll services, benefits management, and so on.  The degree to which "relies" becomes involved is subjective.  Is it "cloud" oriented to share and mark-up engineering drawings within a collaborative web portal?  Or is it "cloud" when the engineering drawing application itself resides on an external web portal along with the drawings?  The answer is "yes".  It's a vague term, but it gets kicked around so much that many are left just nodding as if they get it, when secretly they don't feel very confident about it.  It's not a confident monicker.

But what is it good for?

That's up to you.  What is a truck good for?  To you it helps with shopping and carrying lawn care materials home.  To a business it means resource distribution and logistics management.  To a club it means carrying a team down a country road to meet for important events.  For a football team it carries the mascots and cheerleaders across the field at half-time.

It's a tool.  Just like computers, networks, software, and wires.  They're all tools.  What they are good for is a matter of what you need them for.

Some people may find cloud services of extremely powerful use to them.  Others may find it uninteresting.  Some may want to try it out and see where it fits into their overall needs.  Some will shy away from it citing regulatory or security concerns.  Whatever your view, at least look at some of the services out there and read up.  Learn what you can.  Then decide what you want to do with it.

I'm sorry if I seem non-committal, but I suppose I am.  Probably the mark of a consultant's world.  We always answer tough questions with "well, it depends".  That's a silly cliché, but it's really the most appropriate answer in most cases.  After 25 years working with computers I've learned to treat knee-jerk answers with caution.

Me personally, I don't have much use for Amazon S3, Microsoft's Azure, or SalesForce.com.  But that doesn't mean those may be of enormous importance and benefit to others.  That's why I say "it depends".

What's good?

Cloud services offload your infrastructure management overhead.  This includes facility space, utilities, logistics (scheduling the T-1 guy and the phone guy, etc.), hardware purchasing and provisioning, patch management, updates, support teams and call rotation schedules, heating and cooling impacts, backups and disaster recovery, and so on.  Those are some hefty reasons to consider it.  It's like saying: "Hey Microsoft, I can't really handle my own data center and server admins, so I'd like you to handle it for us"

What's bad?

There really is no outright "bad" here.  There are risks, that's a given.  Loss of Internet connectivity is probably the biggest concern for most businesses.  After that would be security, fault tolerance, disaster recovery response time, support responsiveness, flexibility, costs (real vs perceived) and so on.  But another recent risk that only emerged since the acquisition of Drop.io by Facebook is what happens when the service is acquired by a competing business or just goes out of business?  What garantees do you have?

Like I said: You have to educate yourself on not only what the general state of the art is, but what each player brings to the table, as well as what risks are incurred.  Then you need to carefully weigh those risks and compare the real costs, which can be tricky.  You will find that many of the aspects for cost comparison are the same as doing the business case for virtualizing servers and services.  Even if you have no plans to jump on the cloud services wagon, at least educate yourself and map out why you should or should not recommend it for your business.  The executive team will be most impressed that you took the initiative on your own (hey, a little job security never hurts).

Monday, April 26, 2010

Windows 7, MSG.EXE and Group Policy Preferences

So, as of Windows Vista, NET SEND is gone.  But you want to send a console message via popup to a remote user or computer?  Windows Vista shipped with the MSG.EXE utility, which is still around in Windows 7.  But there’s a small problem, which led me to another small problem, but thankfully there’s an easy solution.

Problem 1 – You may need to modify a Registry Value on all your networked Windows 7 computers.

  • HKLM\SYSTEM\CurrentControlSet\Control\TerminalServer
  • Value: AllowRemoteRPC
  • Required value: 1 (REG_DWORD)

Problem 2 – Trying to set that on a remote Windows 7 box

The Remote Registry service is disabled by default.  You can start turning on services manually, but…

Solution – Use Group Policy Preferences to do it all at once

  1. Create a new GPO named something that makes sense
  2. Edit the new GPO
  3. Expand Computer Configuration / Preferences / Windows Settings
  4. Click on Registry
  5. Right-click and select New –> Registry Item
  6. Select Action: Update, Hive: HKEY_LOCAL_MACHINE
  7. Key Path: browse to the key shown above
  8. Select the Value name: AllowRemoteRPC
  9. Set the Value data: 1, specify type REG_DWORD
  10. Click OK

If you also want to enable remote Registry editing…

  1. Expand “Control Panel Settings”
  2. Select “Services”
  3. Right-click and select New –> Service
  4. Startup: Automatic, Service Name “Remote Registry”, Service Action: Start Service
  5. Click the Recovery tab
  6. Specify First and Second failure action as “Restart the Service”
  7. Specify Restart fail count after to 1 day, Restart service after 1 minute
  8. Click OK

Tuesday, February 17, 2009

Windows 7 / 2008 R2 Managed Service Accounts

For years I have argued that making domain "service" accounts is stupid.  Most people look at me like I'm clacking sounds with duck lips and dancing on one foot.  Seriously, it's dumb.  I've seen so many environments where admins create "service" accounts in AD just "because".  It's a habit that started with NT4 and never died.

There are still a few (rare) cases when it makes sense, but since Windows XP and Windows Server 2003, it almost always make better sense to use computer accounts and grant rights accordingly.  That means using the local "System" account.  Ever seen the "Domain Computers" group and wondered what it was good for? How about those Computer$ accounts?  Because this makes people have to think (and many hate to think) they don't want to bother with GPO issues, and so forth.  But it really is easier and simpler to manage once you go that route.

This isn't my idea.  Microsoft has been pushing for this for a long time.  Anyone who has implemented SMS 2003 or SCCM knows what I'm talking about.  It was called "Advanced Security" but it's really simple security, because you don't have to worry about passwords or access to the account itself, because it's the computer account and only people with local Admin rights to the computer could commandeer the account for malicious or unauthorized use.  Compare that with a domain user account which is essentially floating in the open and doesn't need to be instantiated from a specific host on the domain. 

Windows 7 and Windows Server 2008 R2 now introduce a new type of domain account called a Managed Service Account.  This is an interesting concept and should bring a smile to the faces of those who want to get away from the old way but are daunted by the challenges of dealing with some of the obscure issues of the "new way" using computer accounts.  But what was disappointing for me was learning that the only way to create an MSA is by using PowerShell.  I had been searching and reading and wondered about the new option in ADUC (which they show and discuss on the AD Doc Team blog), but the PowerShell approach is the only way that works right now.  I can't tell if that is going to be the permanent solution, or if it's just during the beta.

Part of it makes sense.  Somewhat like how you have to manually enable the AD Schema Management MMC snap-in, or turn on "Advanced Features" in ADUC in order to access the Security tab on objects.  The implication is that it is a sensitive, critical feature, and should therefore be somewhat obtuse and obscure to access.  This helps avoid accidental screw-ups for sure.  But I wonder if an MSA is "that" touchy.

I made the claim that I was moving away from Active Directory, SMS, System Center, and so on, which I definitely have.  Not by choice, but by circumstance.  This was just something that got me thinking again after a long time away from it.  That said, I think I won't be posting techy stuff here anymore except for script code if anything.

Thursday, August 21, 2008

Using the SYSTEM account instead of a domain user Service account

Man, this comes up all the time, but I still get on the bandwagon and try to reiterate the benefits of this each time it comes up.




When running a scheduled task, especially for things like scripts or back-ups or monitoring services, etc. you should ALWAYS try to make it work using the local SYSTEM account rather than a domain user "service" account. Why?


  1. No having to deal with passwords.


  2. Much more narrowly defined security model


  3. Local administrative rights


  4. Simple as dirt


What exactly am I talking about?


A domain user "service" account is simply a user account created in Active Directory, which is almost always granted special domain group and security rights, and is used to run scheduled tasks unattended. The problem is that such accounts are managed in the "open" and require a *known* password. Known by someone. Anyone. This introduces two problems:



  1. The person that knows the password has to record it securely and ensure there is a failsafe backup (someone else has access to the password in case person "A" is hit by a bus).


  2. The password may require being reset on a periodic interval (group policy or even worse: SOX)


By using the built-in, local "SYSTEM" account, you circumvent a lot of these issues, and make the security model much simpler to manage. For example:



  1. The password is managed by the computer itself (and AD). No human involvement here.


  2. The password resets are handled automatically.

To make this change, you need to understand that computers have account in Active Directory just like Users do. The only functional difference is that the name has a $ suffix appended and computers are only members of one domain group by default: Domain Computers. This group, by default, is not a member of any other groups. Not even "users" or "domain users". It's a group on a shelf, waiting to be used if needed.


So if you run a task on computer "A" that needs to read from, or write to, a shared folder on computer "B", you simply grant either (A) the specific computer account "A$" or the domain group "Domain Computers", the appropriate rights to the shared folder. That's it. Done. This model works extremely well in most cases. I've used it for back-ups, monitoring, scripting, reporting, scanning, and lot's of things.


Is this "new"? Not at all. Microsoft uses this model for SMS 2003 "Advanced Security" as does System Center Configuration Manager 2007 and System Center Operations Manager 2007. Many other products, Microsoft and others, use this security model as well.


So why haven't IT administrators and software developers climbed on board with this? I have no freaking idea. It's so much simpler and cleaner and less hassle. Maybe this will catch on, but so far I'm not seeing it spread like wildfire.