Slashdot Mirror


Ask Slashdot: Moving From *nix To Windows Automation?

Zubinix writes "I have a background in doing automation in a Unix/Linux environment using scripting languages such as perl and bash shell, as well as ssh for remote scripting. My next project will be in the Windows environment so what approach and methodology is best for developing, say, the automation required for a test system? I don't want to use things like Cygwin, as I need to integrate with Windows applications such as Exchange and Sharepoint. Is there a list of should and should not dos when it comes to Windows automation?"

427 comments

  1. Dos and Donts by Anonymous Coward · · Score: 0

    Dont:
    Windows Automation

    1. Re:Dos and Donts by 1s44c · · Score: 1

      Dont:

      Windows Automation

      Do:

      Hire a windows guy to do it for you and keep him around to do it manually when windows starts acting non-deterministically.

      Proper automation just doesn't work on windows, it's too flaky. At best you might get 98% automation and 2% some guy cleaning up random failures.

  2. Powershell by Anonymous Coward · · Score: 0

    'nuff said

    1. Re:PowerShell by Anonymous Coward · · Score: 0

      Agreed. Powershell, vbs and windows scheduler.

      Do NOT try to program your own event scheduler. It WILL fail. I read that somewhere else, ignored it, and can save you time by saying it's true.

  3. WMI by stanlyb · · Score: 5, Informative

    Your answer to everything is WMI. Just start command prompt, type :> wmic And voila, you are ready

    1. Re:WMI by CastrTroy · · Score: 1

      WMI is really powerful, I only wish the documentation was better. You can do some really powerful things with VBScript and WMI.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    2. Re:WMI by KevMar · · Score: 1

      Powershell does a great job of bringing WMI to the shell.

      Get-WMIObject WIN32_BIOS

      Not only can you query with wmi, but get access to the objects to call various WMI functions.

      --
      Im a gamer, not a grammer major. This post is full of spelling and grammer mistakes.
    3. Re:WMI by maugle · · Score: 4, Funny

      WMI is really powerful, I only wish the documentation was better. You can do some really powerful things with VBScript and WMI.

      Wait a second, something's not right here...

      Linux has well-known utilities that everyone is familiar with?
      Windows has powerful tools with terrible documentation?

      I AM IN BIZARRO WORLD!

    4. Re:WMI by mysidia · · Score: 4, Funny

      WMI is great. If you liked the complexity of CORBA, COBOL, VB Script, and the syntax of SQL, you will love WMI.

    5. Re:WMI by Anonymous Coward · · Score: 0

      Complexity? VB Script?! Limitations, maybe.

    6. Re:WMI by davester666 · · Score: 1

      Not really, because it's relative.

      Linux has poor documentation.
      Windows WMI has terrible documentation.

      --
      Sleep your way to a whiter smile...date a dentist!
    7. Re:WMI by TheReaperD · · Score: 1

      WMI is always broken on a handful of systems in a large user base. No matter how much effort you expend trying to fix it, some will always be broken. WMI is only a 100% solution if your user base is small. We have a 10,000 system user base and we never got below 3% of systems with a WMI failure, reguardless of how much time we put into fixing them. We gave up and have climbed to 7%. We now use cmd scripts primarily with Altiris, BixFix, AutoIT filling in with what cmd can't do, which is a lot. We still can't crack that 3% fail rate but, many will fix themselves on retry and we spend a whole lot less time fixing them. Still requires a lot of hours in remote desktop though. :/

      --
      "Be particularly skeptical when presented with evidence confirming what you already believe." -
    8. Re:WMI by Anonymous Coward · · Score: 1

      WSH, not WMI... that's what I get for writing this at 1:30 in the morning. --TheReaperD

    9. Re:WMI by DaleHarris · · Score: 1

      Agree with above post. Powershell is going to be your bread and butter. I've been working in a Windows Environment for over 6 years and Powershell is by far the most useful thing. It's the Admin Console for Exchange 2007 and up, Sharepoint 2010 and up, and a slew of other products. If you want to get your hands dirty in Powershell, a good way to start would be to read the articles posted on EE. Experts-Exchange.com has a few Powershell articles to get you up and running relatively easily. And yes, I may have written a couple of articles on there. http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/A_4327-PowerShell-Where-do-I-start.html Good luck and Powershell is extremely worth your investment of time.

    10. Re:WMI by 1s44c · · Score: 1

      WMI is always broken on a handful of systems in a large user base. No matter how much effort you expend trying to fix it, some will always be broken. WMI is only a 100% solution if your user base is small. We have a 10,000 system user base and we never got below 3% of systems with a WMI failure, reguardless of how much time we put into fixing them. We gave up and have climbed to 7%. We now use cmd scripts primarily with Altiris, BixFix, AutoIT filling in with what cmd can't do, which is a lot. We still can't crack that 3% fail rate but, many will fix themselves on retry and we spend a whole lot less time fixing them. Still requires a lot of hours in remote desktop though. :/

      WMI automation could work if you kept all windows machines totally identical, reinstalled at the first sign of flaky behavior, and tightly controlled all data that gets onto these machines. Yeah, I know it's not practical in most environments.

    11. Re:WMI by 1s44c · · Score: 1

      Wait. People actually use Experts Exchange?

      I thought that site was an attempt at trolling google searches.

    12. Re:WMI by alexo · · Score: 1

      Wait. People actually use Experts Exchange?
      I thought that site was an attempt at trolling google searches.

      A decade ago, Experts Exchange used to be a usable site. Nowadays, I advocate avoiding it. Stack Overflow should take care of your needs.

  4. Windows Powershell by Anonymous Coward · · Score: 0

    Your best bet is to learn Windows Powershell (ships by default with win7): http://msdn.microsoft.com/en-us/library/aa973757(v=vs.85).aspx

    Its scripting language is built on .NET and provides access to all of the power and flexibility available in the .NET framework. You can also write your own commandlets/plugins in C#/VB.NET to extend Powershell's capabilities.

    1. Re:Windows Powershell by 19thNervousBreakdown · · Score: 1

      The fact that you need to integrate with Exchange pretty much makes this a necessity. Even if you go with something else, you'll have to do PowerShell to talk to Exchange.

      --
      <xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
    2. Re:Windows Powershell by cynyr · · Score: 1

      and yet provides no way to simply double click on the script to run it... It may not have supported dragging files onto it, but i'm not sure i even made it that far.

      --
      All of the above was encrypted with a Quad ROT-13 method. Unauthorized decryption is in violation of the DMCA.
    3. Re:Windows Powershell by man_of_mr_e · · Score: 1

      What are you talking about? PowerShell scripts use the extension .ps1. Double click, and it runs.

    4. Re:Windows Powershell by man_of_mr_e · · Score: 1

      Actually, there are many options, but it depends on what you're trying to do. There are lots of third party administration tools. If all you want to do is use the default toolset, then PowerShell is your only logical choice.

    5. Re:Windows Powershell by ozmanjusri · · Score: 0

      Isn't lockin marvellous?

      --
      "I've got more toys than Teruhisa Kitahara."
    6. Re:Windows Powershell by Anonymous Coward · · Score: 0

      You forget that most of the people here are looking for any excuse to give up on using anything they don't understand so that they don't have to learn any more about it. These are people that are used to writing massive bash scripts and then chmodding them so that they actually become executable before they'll even run, but won't even try right clicking a ps1 file and choosing 'open with' if their file association didn't come up right.

    7. Re:Windows Powershell by Dr_Barnowl · · Score: 1

      Not by default. By default, their shell association is to open in notepad. Which I actually prefer.

    8. Re:Windows Powershell by pjt33 · · Score: 1

      I think that when Windows Update installed PS2 on my Vista box at work it changed the default association to some new editor MS have created just for debugging Powershell scripts.

  5. Windows Powershell by Anonymous Coward · · Score: 0

    not too many options - Windows PowerShell, that's about it.

  6. Re:Don't do it... by x*yy*x · · Score: 3, Informative

    And why not? Powershell is perfect for the job.

  7. Is not the question backwards? by lsolano · · Score: 1

    Is it?

    1. Re:Is not the question backwards? by paulmac84 · · Score: 1

      It is?

      --
      One of the universal rules of happiness is always be wary of any helpful item that weighs less than its operating manual
  8. a VM... by Anonymous Coward · · Score: 1, Funny

    > what approach and methodology is best for developing, say, the automation required for a test system?

    Install Linux in a VM, and do all the automation from there.

    Then you can eventually migrate to removing the Windows machine and running Linux directly on the hardware.

    1. Re:a VM... by telekon · · Score: 0

      Install Linux in a VM, and do all the automation from there.

      Then you can eventually migrate to removing the Windows machine and running Linux directly on the hardware.

      ^ Best suggestion whole thread.

      --

      To understand recursion, you must first understand recursion.

    2. Re:a VM... by JWSmythe · · Score: 4, Interesting

          Amazingly enough, that's something I'm doing right now. (no, I'm not the original author). I smoothed over the rough spots as much as possible, and now we're doing the Linux migration. It's a long, slow process to change a decade of deep rooted Windows-isms, but it will happen soon enough. The only Windows that will be left will be the workstations for those who choose not to switch over to Linux. In a web based enterprise, there's no excuse for being locked into any platform.

      --
      Serious? Seriousness is well above my pay grade.
    3. Re:a VM... by Anonymous Coward · · Score: 3, Funny

      Why would you switch to Linux - an inferior, security ridden, and an OS which can't stay up longer than a month?!
      It's a hobbyist OS at best and doesn't survive in a real commercial environment.

    4. Re:a VM... by ModernGeek · · Score: 2

      The only way that Microsoft can improve Windows at this point is to make it run well on virtual machines so that it can be a little bit easier to migrate away from.

      --
      Sig: I stole this sig.
    5. Re:a VM... by datapharmer · · Score: 1

      Yeah, which is great and all until you realize that most business require group policy...

      --
      Get a web developer
    6. Re:a VM... by hax4bux · · Score: 1, Offtopic

      kludge@elvis:101>uname -a
      Linux elvis.goaway.com 2.6.16-1.2069_FC4smp #1 SMP Tue Mar 28 12:47:32 EST 2006 i686 i686 i386 GNU/Linux
      kludge@elvis:102>uptime
        18:07:02 up 647 days, 21:56, 18 users, load average: 8.53, 7.78, 7.76

    7. Re:a VM... by RooftopActivity · · Score: 0

      dave@psn.sony.com:/# mail kludge@goaway.com -s "URGENT: machine reboot"
      Hi Kludge,
      Did you remember to reboot elvis 643 days ago, after we re-compiled the kernel with critical security updates? It looks like there may be a problem
      .
      ^D
      dave@psn.sony.com:/# how do I get the fucking data back
      bash: how: command not found

    8. Re:a VM... by Anonymous Coward · · Score: 0

      Suprising for a linux box.
      My P3 450mhz Windows XP server had been up for almost 3 years serving torrents, etc.

      The only reason I switched it off was due to moving home.

    9. Re:a VM... by JWSmythe · · Score: 1

      I'm jealous. I don't have any machines with that much uptime. There's always something. Changing datacenters, upgrading kernels for new functionality, and the famous "sorry dude, I kinda unplugged your server, hope you don't mind."

          The best I had was 3 years, and then had to move the servers. I forgot to get the uptime before I moved them.

      --
      Serious? Seriousness is well above my pay grade.
    10. Re:a VM... by RobbieThe1st · · Score: 1

      My P3 450mhz Windows XP server had been up for almost 3 years serving malware, etc.

      FTFY

    11. Re:a VM... by Anonymous Coward · · Score: 0

      Hahahaha, Tomorrow night I get to reboot my DB app servers that have been up for > 1 year. The main reason is to clear up the open/deleted files that are soaking up memory due to lousy application programming and log rotation practices. Maybe the Linux OS's that you deploy can't stay up for a week. Its a poor mechanic that blames his or her tools! I also spent the last two evenings spoon feeding whats left of my step sons laptop from all the viruses and malware thats brought a cranking machine to its knees. It works great now, even thought I didnt install Linux on it :^)

    12. Re:a VM... by darkpixel2k · · Score: 1

      The only way that Microsoft can improve Windows at this point is to make it run well on virtual machines so that it can be a little bit easier to migrate away from.

      You might be modded 'troll', but that's exactly what we're doing. The infrastructure at a majority of our clients is Linux on the servers, NAS', routers, firewalls, mail servers, etc... Where Windows is required, it runs in a VM on a linux box.

      --
      There's no place like ::1 (I've completed my transition to IPv6)
    13. Re:a VM... by 1s44c · · Score: 1

      Why would you switch to Windows - an inferior, security ridden, and an OS which can't stay up longer than a month?!
      It's a hobbyist OS at best and doesn't survive in a real commercial environment.

      FTFY

  9. Learn VBScript by MrEricSir · · Score: 2

    Hate to say it, but you should probably learn VBScript. There's a VBScript interpreter is built into Windows, and it can interact with COM. It might be a pain, but it will suit your needs.

    --
    There's no -1 for "I don't get it."
    1. Re:Learn VBScript by Anonymous Coward · · Score: 0

      Well, when you're leaving bash, VBScript is actually an improvement. For all its limitations, at least it's half-a-decent programming language. And if half-a-decent isn't good enough, you might opt to actually move on to VB or C++ or Python or whatever strikes your fancy. All Windows automation that you might want to do is exposed through a COM interface and there is no programming language targeting the Windows platform that doesn't include support for COM.
      On a personal note, when decided to switch from command scripts to a programming language, I was afraid that it would be hard. But it turned out that most things are actually easier (if at times a bit more tedious) and it's a lot harder to shoot yourself in the foot in most of them. At the very least you'll never get errors caused by the unpredictable script syntax again.

    2. Re:Learn VBScript by Anonymous Coward · · Score: 0

      JScript can do all the same in JavaScript, which is at least C-like
      that kinda makes me wonder why anyone would even write in VBScript

    3. Re:Learn VBScript by mikael_j · · Score: 4, Informative

      All Windows automation that you might want to do is exposed through a COM interface and there is no programming language targeting the Windows platform that doesn't include support for COM

      What about languages that aren't so much targeting Windows but just barely support it?

      On a personal note, when decided to switch from command scripts to a programming language, I was afraid that it would be hard. But it turned out that most things are actually easier (if at times a bit more tedious) and it's a lot harder to shoot yourself in the foot in most of them. At the very least you'll never get errors caused by the unpredictable script syntax again.

      BASH is basically turing complete. Also, "[...]at times more tedious[...]" is the issue. I do 95% of my work in a Windows environment and a lot of times I long for the simplicity of *nix. Most of the time in Windows I feel like I'm fighting a huge and complex system, trying desperately to make it behave in a sane and rational way in order to produce the desired output. In the *nix world at least it's just my code I'm battling with, not the entire OS and ecosystem. But hey, maybe some people actually like a world where all systems communicate using XML and where character encoding is "enicode" yet in practice can be pretty much anything as long as the marketing division can claim it's all unicode because technically the operating system uses unicode internally...

      --
      Greylisting is to SMTP as NAT is to IPv4
    4. Re:Learn VBScript by Anonymous Coward · · Score: 0

      WSH scripts can also be created in JavaScript, which I personally prefer the hell out of. There are only a couple of limitations to making your WSH scripts in JS rather than VBS (no MsgBox function, but you can fake it by calling an external VBS scripts whose sole purpose is to display a MsgBox based on passed parameters :), and the code is so much more readable.

      PowerShell is making WSH irrelevant, but if you're in a mixed and unpredictable Windows environment, some of your older boxes may not have PowerShell installed. WSH still has a place in those environments.

    5. Re:Learn VBScript by Anonymous Coward · · Score: 0

      Not in this decade. You'd be much better off with Powershell, especially if you're looking at integrating with SharePoint 2010, etc. That's for sysadmin automation, though... for testing, you're probably better off with Visual Studio Test Edition for unit/web testing.

    6. Re:Learn VBScript by Lennie · · Score: 1

      Everything you can do in VBScript you can do in JavaScript. And JavaScript is a much better language.

      --
      New things are always on the horizon
    7. Re:Learn VBScript by MightyMartian · · Score: 1

      No kidding. VBScript certainly is easier to code in than the abortion that NT batch scripting is, and is considerably less awkward than PowerShell, which is a typical attempt by Microsoft to make one better than the Bourne shells, only to, just as typically, be more awkward and far less polished.

      What I would give for Microsoft to just admit that the Unix guys weren't complete fuckups and actually understood something about scripting and assembling a damned good toolkit and just rip it off, adapt it to Windows and be done with it. But no, they've got this penis envy thing going that always leads them down the road of oneupsmanship.

      Great, they won the desktop wars, but after fifteen years of using both *nix and Windows server variants, *nix still kicks Windows ass.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    8. Re:Learn VBScript by man_of_mr_e · · Score: 1

      2005 called and wants it's arguments back. PowerShell has been around for quite a while now, no VBScript required.

    9. Re:Learn VBScript by Anonymous Coward · · Score: 0

      you can install perl
      or
      you can use VBscript or Jscript (I use the latter just cause I could.)

    10. Re:Learn VBScript by Tomji · · Score: 1

      True, but every other admin uses VBscript i am afraid.
      I used to be all about JScript until I started at a larger company. Now, VBScript doesn't seem all that bad anymore.

    11. Re:Learn VBScript by spongman · · Score: 2

      not everything, VBScript handles optional arguments, Variants and SAFEARRAYS better than JScript. All key differences when talking to COM.

    12. Re:Learn VBScript by Anonymous Coward · · Score: 0

      please dont. Unless you absolutely have to, and you really have to be dealing with some specific niches, do not waste your time dealing with vbscript.

      Windows has a far stronger scripting language in Powershell, which is also built into recent Windows versions - and downloadable for xp.

    13. Re:Learn VBScript by drinkypoo · · Score: 2

      Unix toolkits have been adapted to Windows on numerous occasions. This story is littered with descriptions and mentions of various toolkits for languages like Ruby and Python. Heck, Perl has long had a variety of modules for approaching Windows. And Cygwin is shot down right in the summary. Then of course there's Services for Unix, and let us not forget ye olde MKS Toolkit.

      The problem is that none of them really fit Windows all that well, although I'm sure you can accomplish quite a bit in most of them. I've used perl for some Windows-specific user and registry manipulation in the past; it works. But the Unix Way is to have lots of small programs that are individually relatively easy to approach. The Windows way is to have to use some baroque API to communicate with anything.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    14. Re:Learn VBScript by It+took+my+meds · · Score: 1

      KiXtart is by far the best admin scripting language. With VBScript you have to instantiate a COM object to do pretty much anything and has an annoying syntax. Whilst KiXtart fully supports COM, it also a has a ton of really useful inbuilt functions and it will it run on every version of Windows. Check out http://www.kixtart.org./ There is a very large community and hundreds of UDF's.

    15. Re:Learn VBScript by Anonymous Coward · · Score: 0

      Powershell has taken the place of VBScript on Windows 7 and Server 2008. It's much much better than VBScript in tons of ways.

    16. Re:Learn VBScript by TheLink · · Score: 1

      I had problems getting kixtart stuff to read UTF-8 stuff from the registry.

      So I had to rewrite stuff in vbscript which does that a bit better (but not much better[1]), but sucks and is slower.

      [1] IIRC there's a function to read UTF-8 values from registry keys, BUT it only supports limited types. There is a function that reads ASCII values from registry keys and it's not so fussy about type. Whoopee.

      --
    17. Re:Learn VBScript by chentiangemalc · · Score: 1

      With SharePoint & Exchange interaction with these in VBScript is a serious pain. Best to use PowerShell, can do more with about 1/10th the coding required of VBScript. I would only use VBScript if you require it for backwards compatibility with older systems. (i.e. pre-XP) Some comparisons between Bash and PowerShell http://w3.linux-magazine.com/issue/78/Bash_vs._Vista_PowerShell.pdf Resources on the net are everywhere for PowerShell just google. If you do tasks in Exchange 2007/2010 management console you'll get to see the powershell scripts used to perform the task.

    18. Re:Learn VBScript by It+took+my+meds · · Score: 1

      I honestly can't say that I've experienced this particular issue. The thing about KiXtart is that even if the inbuilt registry function didn't work, you could still use methods the VBScript can to access the registry as they all rely on COM.

    19. Re:Learn VBScript by sourcerror · · Score: 1

      "BASH is basically turing complete."
      So is Brainfuck and Whitespace.

    20. Re:Learn VBScript by Anonymous Coward · · Score: 0

      So what you are saying that would be the easiest way? Why do you say then it might be a pain? Other than the usual "Microsoft sucks in everything" Slashdot reason.

    21. Re:Learn VBScript by Anonymous Coward · · Score: 0

      No! Let VBScript die! You can do anything you need (including COM and WMI integration) via PowerShell. It's like bash on steroids. I love being able to pipe *objects* - not just text.

    22. Re:Learn VBScript by Anonymous Coward · · Score: 0

      or, learn Javascript (er, JScript). There's a JScript interpreter is built into Windows, and it can interact with COM. It might be a pain, but it will suit your needs.
      What, you already know Javascript? Bonus!

    23. Re:Learn VBScript by Anonymous Coward · · Score: 0

      Learn Powershell first. Most places should already have it built into their server builds by now, and it offers tons upon tons of more functionality than VBscript ever does. It's also closer to bash/python than VBscript, making it much easier to pick up for UNIX sysadmins. VBscript is still important, but Powershell is significantly more so (i.e. it's more marketable!).

  10. PowerShell by Anonymous Coward · · Score: 0

    Windows automation now-a-days == PowerShell. It is actually powerfull and pretty well thought through.

  11. Re:Don't do it... by Anonymous Coward · · Score: 1

    Hmm...

    If you really must, I guess really the only thing Microsoft is trying to push now is Powershell. It works, but it is an abomination.

    You'd be better off getting familiar with Boo (http://boo.codehaus.org) or Ruby or Python/IronPython, imho.

    Boo is a .Net scripting language with lots of Python-isms. Its scripts are compilable to .Net exes.

  12. Or... by dzr0001 · · Score: 2

    You already mentioned using Perl in your *NIX environments so you could do the same with your Windows boxes too. You could also use Python. Powershell is probably your best option.

    1. Re:Or... by hedwards · · Score: 1

      This, but ultimately it depends a lot upon how well the scripts were coded and whether or not portability was taken into consideration. If the scripts use the relevant modules to handle things like paths, that's much more likely to work out. But if they haven't, it's probably going to be a huge pain to try and port them over to Windows.

    2. Re:Or... by Thing+1 · · Score: 1

      I don't think GP meant port the scripts over; just that Perl and Python are available on Windows to perform the sorts of automation tasks that Exchange and SharePoint are going to need. (I don't think they have already-written Perl scripts to automate Exchange on Linux, in other words.) PowerShell is an option, but I prefer to stick with tools that give me skills that can be applied more broadly.

      --
      I feel fantastic, and I'm still alive.
  13. Tons of options by Skuld-Chan · · Score: 3, Interesting

    There are bunches of tools out of the box to automate things in Windows - the scripting host (supports js/vb), power shell, and wmi - or a combination of things. You can open a wmi interface in vb for instance.

    1. Re:Tons of options by Idbar · · Score: 1

      Well, yes. BUt can you write a script in WMI that launches a GUI from VB to track an IP address?

  14. Assuming you absolutely have to use Windows... by Alanbly · · Score: 5, Interesting

    When I was working in Software Quality Assurance we had a lot of luck with Mercury Quick Test Pro and Test Batch Runner. They have a solid recording interface than can be coded manually (in VBScript.Net but what can you do?). Integrated fabulously with C# .Net code for doing black-box and grey-box testing. I'd also suggest Symantec Ghost for setting up test systems.

    --
    -- Adam McCormick
    1. Re:Assuming you absolutely have to use Windows... by Meshach · · Score: 2

      In a similar vein TestComplete from AutomatedQA is another tool that provides a similar experience. There are several different available languages (VB, Delphi, ...) and they provide a wide range of methods from a simple Record/Play to coding.

      Also VMware is another tool good for setting up multiple "clean" systems for testing.

      --
      "Maybe this world is another planet's hell"
      Aldous Huxley
    2. Re:Assuming you absolutely have to use Windows... by religious+freak · · Score: 2

      I'll second this. QTP is *the* standard for automated testing. There are others, but QTP is the best. If you want more info check out this forum.

      sqaforums.com - look up Quick Test Pro and get to work. Everyone talking unix is talking nonsense. If you're in a Windows environment, you work with that. You go in talking unix stuff and you're likely to get fired.

      --
      If you can read this... 01110101 01110010 00100000 01100001 00100000 01100111 01100101 01100101 01101011
    3. Re:Assuming you absolutely have to use Windows... by religious+freak · · Score: 1

      Ah - I will say that if budget is an issue some of the other options like vbscript will work, but they're more labor intensive. Do yourself a favor and push for QTP.

      --
      If you can read this... 01110101 01110010 00100000 01100001 00100000 01100111 01100101 01100101 01101011
    4. Re:Assuming you absolutely have to use Windows... by Anonymous Coward · · Score: 0

      Ghost is pretty good, but it's extra money to spend out when you don't need to.

      I'd recommend Windows Deployment Serivices / Remote Installation Services that's included in Windows Server. It allows you to PXE boot a machine, copies the Windows installation files to it, and when configured with an installation script will automatically configure your system (Product key, timezone, etc...)

      When you combine it with ability for Group Policy to install software on machines based on their OU, it becomes extremely powerful. It's possible for a single engineer to build an entire office of PCs in a very short period of time.

    5. Re:Assuming you absolutely have to use Windows... by Culture20 · · Score: 1

      I'd recommend Windows Deployment Serivices / Remote Installation Services that's included in Windows Server. It allows you to PXE boot a machine, copies the Windows installation files to it, and when configured with an installation script will automatically configure your system (Product key, timezone, etc...)

      It multicasts like ghost? If not, scaling will be painful.

  15. autoit by Anonymous Coward · · Score: 0

    autoit or powershell are about as good as it gets for windows automation.

    1. Re:autoit by Jonah+Hex · · Score: 1

      AutoIT gives you the flexibility to make Windows your bitch.

      HEX

  16. C++ by Grindalf · · Score: 0

    C++ is much faster than all that stuff, I've used it for years - it's a synch! Top Tip!

    --
    The purpose of existence is to make money.
    1. Re:C++ by spongman · · Score: 1

      yeah, because CPU optimization is really important when distributing commands/queries to multiple remote systems...

    2. Re:C++ by Anonymous Coward · · Score: 0

      why do you even answer to retards with such a high UID?

    3. Re:C++ by Grindalf · · Score: 1

      No you are wrong, C++ is a much more capable enviroment - look it up in MSDN. Scripts are for stupid people who are not bright at computer science. Binarization is far better.

      --
      The purpose of existence is to make money.
  17. Re:A millions monkeys comes to mind by Anonymous Coward · · Score: 0

    Mod parent up.

  18. Powershell by Anonymous Coward · · Score: 0

    Powershell is probably your best bet.

  19. Embrace the Dark Side (.net) by spacecowboy420 · · Score: 5, Informative

    So, been down this EXACT road. I was doing Linux automation, was so effective was brought in to do Windows too - yea!
    Anyway, tried the cygwin route... It went OK, but just not quite it.
    Went the vbscript route for a while (pure hell), but could work with wmi and had the windows objects available.

    Soon, I started writing console apps in C# to make the trickier stuff happen. The .Net framework made it all so easy.

    My final set of tools came to be powershell (access to the .net framework, you can do almost anything), Systernals psexec (for running processes on remote machines), and basic vbscript .bat. I had it set up with a web interface so I could enter a dos command into a web interface and point it a machine. It would build the bat and run it on the remote machine and return the standard out. This allowed me to add IIS sites and app pools, install com components, install apps, run msunit tests, and basically do whatever I wanted to any machine on the domain. Took me a quarter to build, but worked well. I've moved on in the company, but my replacement is still using it.

    --
    ymmv
    1. Re:Embrace the Dark Side (.net) by Mia'cova · · Score: 1

      PowerShell supports remoting now which is nice.

    2. Re:Embrace the Dark Side (.net) by Zubinix · · Score: 1

      Good response. Thanks!

    3. Re:Embrace the Dark Side (.net) by spacecowboy420 · · Score: 2

      I used remoting for some stuff, but for some reason, psexec just worked easier. Plus it was easier to specify a user on the command line. I know, I could have done it with config files but when I wanted to do just a one off dos command, it was just easier.

      --
      ymmv
    4. Re:Embrace the Dark Side (.net) by shutdown+-p+now · · Score: 2

      Note that you don't need C# to deal with .NET and related stuff. IronPython can use anything from .NET directly just as well, but also has many stock Python modules available. And it might be more familiar to someone with Unix background, and its dynamic nature is better suited for scripting tasks typical of automation.

      There's also IronRuby if you prefer the language.

    5. Re:Embrace the Dark Side (.net) by eulernet · · Score: 1

      This allowed me to add IIS sites and app pools, install com components, install apps, run msunit tests, and basically do whatever I wanted to any machine on the domain.

      As a .Net developer, I had to add some scripting facilities on our platform (32 2003 servers and 64 bits 2008 servers).
      There is a thing that is impossible to do in Powershell: IP restriction of a website.

      The problem is that the IP restriction is a COM object, and there is no mapping in .Net.

      Add to the fact that 2003 and 2008 behave differently, and you'll realize that it's a lot of work to even make the basic things.

    6. Re:Embrace the Dark Side (.net) by adonoman · · Score: 1

      Powershell can do COM objects: new-object -com

    7. Re:Embrace the Dark Side (.net) by KevMar · · Score: 2

      There is a lot of power in PowerShell remoting now and its easier than ever to use now.

      Get-Content .\computers.txt | %{ Invoke-Command -ComputerName $_ -AsJob -ScriptBlock { gpupdate /force } }

      This works great for simple stuff. The commands in the -ScriptBlock are ran on the target computer. The -AsJob is not needed, but it basically multi threads the command. Running it on every computer at the same time instead of one at a time. You have to use get-job and related commands to check up on them, but its worth it when I want to run a command on hundreds of computers that may or may not be online.

      I'm sure you may have figured out most of that but may be struggling with network access in remote shells or need different credentials other than your own. You need to enable CredSSP on your remote computers for passthrough authentication (for network access in remote shells). You can enable this in AD for Win7 computers but its a bit more work for WinXP. Using CredSSP requires you to pass credentials. Here is an example that pulls those together.

      $Cred = Get-Credential
      Get-Content .\computers.txt | %{ Invoke-Command -ComputerName "$_.doman" -AsJob -Credential $Cred -Authentication CredSSP -ScriptBlock { //server/share/program.exe } }

      In this Get-Credential will prompt for the username password. I changed the ScriptBlock to run a program off a network share. This would have failed in the first example. One other thing about using CredSSP, it needs a FQDN of the computer. I am not sure if this is any simpler than psexec. I remember using it for automation years ago but have forgotten all about it. I do find all of this easy to remember though.

      I find myself running commands like this all the time now. Combining this with Get-QADComputer from quest to get computer accounts and having wake on lan scriptable will give you tons of power. I just wanted to share with you and everyone else how cool the remoting features of PowerShell can be.

      --
      Im a gamer, not a grammer major. This post is full of spelling and grammer mistakes.
    8. Re:Embrace the Dark Side (.net) by Anonymous Coward · · Score: 0

      I heard powershell was a nightmare. Though it has to be better than Microsoft's "solution".

    9. Re:Embrace the Dark Side (.net) by man_of_mr_e · · Score: 1

      Wow, how hard was it for you to completely ignore the COM interop built into powershell?

    10. Re:Embrace the Dark Side (.net) by man_of_mr_e · · Score: 1

      PowerShell *IS* Microsoft's solution. What are you referring to?

    11. Re:Embrace the Dark Side (.net) by Anonymous Coward · · Score: 0

      I had it set up with a web interface so I could enter a dos command into a web interface and point it a machine.

      Wow, cool. What's your ip address?

    12. Re:Embrace the Dark Side (.net) by VortexCortex · · Score: 2

      My final set of tools came to be powershell (access to the .net framework, you can do almost anything), Systernals psexec (for running processes on remote machines), and basic vbscript .bat. I had it set up with a web interface so I could enter a dos command into a web interface and point it a machine. It would build the bat and run it on the remote machine and return the standard out. This allowed me to add IIS sites and app pools, install com components, install apps, run msunit tests, and basically do whatever I wanted to any machine on the domain.

      Took me a quarter to build, but worked well.

      I've moved on in the company, but my replacement is still using it.

      So... you built SSH for your current Windows setup, in 3 months. I'm glad *nix comes with that little gem so that each IT department using *nix doesn't have to roll their own (like you had to on Windows). Let's hope your program is well documented, and works easily after the next Windows revision...

      I'm glad you were able to hack together your own solution, but wouldn't it be great if MS gave you those options at the CLI and a remote command line interface out of the box, instead of requiring you to build your own? I mean... Don't get me wrong, The ability to pass COM objects around in .net is great -- but why not start off being able to do that at the CLI and build on top of that, so that if you have to, it can all be done over something like SSH. Some people (not me, but some people), don't want to have to write a C# program just to perform "advanced" administration tasks such as automation, and remote terminal access...

      I wonder -- what security measures are in place for your HTML <textarea> to remote .bat system?

      A quote comes to mind, not aimed at you, but MS...
      "Those who don't understand UNIX are condemned to reinvent it, poorly." – Henry Spencer

      In this case, MS has dodged the bullet by simply passing on the condemnation to their Windows admins.

    13. Re:Embrace the Dark Side (.net) by Anonymous Coward · · Score: 0

      127.0.0.1

    14. Re:Embrace the Dark Side (.net) by Rockoon · · Score: 1

      All the .NET languages, including PowerShell, supports COM.

      Admittedly COM is sort of out-of-place, but its all relatively seamless none-the-less.

      --
      "His name was James Damore."
    15. Re:Embrace the Dark Side (.net) by Anonymous Coward · · Score: 0

      Also, if you're not very familiar with Powershell but are good with another .NET language, there's an extension for Red Gate's Reflector that will decompile an assembly to Powershell code. There's usually a bit of cleanup required afterwards but can be really helpful, especially if only used on snippets of code.

    16. Re:Embrace the Dark Side (.net) by rylin · · Score: 1

      The ability to pass COM objects around in .net is great -- but why not start off being able to do that at the CLI and build on top of that, so that if you have to, it can all be done over something like SSH.

      "Those who are forever stuck in a UNIX world are condemned to appear ignorant whenever they talk about non-current versions of windows." -- Me.

      I say that as a long time Solaris and Linux guy, btw.
      PowerShell is one of the recent things Microsoft has done fairly well.

      PowerShell is basically a dumbed down, interpreted version of dotnet. Pass objects all you want!

  20. ...should not dos when it comes to Windows... by Trogre · · Score: 1

    I see what you did there.

    --
    "Nine times out of ten, starting a fire is not the best way to solve the problem." - my wife
  21. Waaa! by Anonymous Coward · · Score: 0

    Do my job for me! Waaa!

    1. Re:Waaa! by Anonymous Coward · · Score: 0

      What an absolute dickbag, asking a community of experts for advise while researching a problem that is new to him. Were I this guy's boss, I'd fire him and hire a guy who could figure out solutions to novel problems by staring a blank wall. At least, then, I'd know that he wasn't slacking off on the job. Or something.

  22. Get familiar with PowerShell by Anonymous Coward · · Score: 0

    If you really want to do an outstanding job, bring all the experience you have with Unix/Linux, but surround yourself with all the windows technology. I've found in the past that when I switch different environments and try to bring the same technology to the new environment, I miss out on all the advantages (and yes disadvantages) of the technology. I've been working in Unix since the 80's and Linux a long time too, and there was a time when you could not even get me to look at a windows environment. But those days are long long gone. The .Net environment is really very good. I think you'll enjoy it, if you give it a chance. Good Luck!

  23. PowerShell by Mia'cova · · Score: 1

    By far your best option. It can take a while to learn though. SharePoint and Exchange use powershell as their main interface for scripting.

  24. Re:Don't do it... by JWSmythe · · Score: 5, Funny

          Day 1) Walk in the door, optimistic about what can be done with this "Enterprise" platform.

        Day 2) Walk in the door, with a headache, hoping to find an answer for how to manage what were simple tasks under *nix.

        Day 3) Walk in the door. Sit down at your desk. Plant your head firmly on the keyboard and cry.

        Day 4) Walk in the door, rip your soul out of your chest, stomp on it, and throw it in the nearest recycle bin. Sit down at your desk, and wonder why in 4 days you can't find a valid answer to automation that was so simple under *nix.

        Day 5) Walk in the door. Sit down at your desk, and think about how miserable you are now that you're working on a Windows-only network. Leave 2 hours early, and drink away your pain at the nearest bar.

        The longer it goes on, the worse the pain gets, until you realize that you have a stash of cheap liquor and pot in your desk drawer, and you use more of both in one day than an entire fraternity use in a hard partying weekend.

          I do have some answers for parts of it. Powershell is part of the answer, but far from complete, unless you like virtually every command you type returning worthless 6 line responses. Cygwin may solve some of the problems, but not all of them. ActivePerl may solve some problems. In the end, you will realize that everything is a mouse click away, and those mouse clicks are the only way to do it. Prepare to spend the rest of your life in remote desktop connections, and putting more miles on your mouse than you ever did playing first person shooters.

    --
    Serious? Seriousness is well above my pay grade.
  25. this is a question more for stackoverflow by gbrandt · · Score: 4, Interesting

    http://stackoverflow.com/ has experts that go there just to help with questions like this.

    1. Re:this is a question more for stackoverflow by Krishnoid · · Score: 4, Informative
      You might also have good luck with http://serverfault.com/ or http://superuser.com/ under the windows and automation tags. Having collected a toolset myself, I'd point you to sysinternals and nirsoft for diagnostic and informational utilities (check out wscc and nirlauncher for a one-stop place for these), autohotkey for automation scripting, and http://portableapps.com/ for apps and general utilities, as a starting point. You can run most or all of these without installing them locally and adding cruft to your registry and random stuff around your filesystem.

      I'd also recommend having a Linux box; you can work in a familiar environment, then share out batch scripts you write via Samba -- read-only for binaries dirs that don't mind being unable to write out config files; writeable (but perhaps not listable) for a centralized location for saving off output from your various scripts, and so forth.

    2. Re:this is a question more for stackoverflow by Anonymous Coward · · Score: 0

      I thought it would be more of a Expert-Sex-Change kind of thing? ;-)

      Anyway, the OP's question is a great troll. Rats out all the sad Windows users on /.

    3. Re:this is a question more for stackoverflow by xtracto · · Score: 1

      Good suggestion. However, Isn't it a sad state o affairs (for slashdot) when users have to be redirected to a third party web page to get answers about questions related to technical computer stuff?

      Appart from what everybody has suggested, I would like to add that a lot of the tools available in Linux (say, awk, sed, cat, and others) for Windows via gnuwin32 (this is not like cygwin but native ported tools). Additionally, it is completely possible to use Python and Perl in Windows.

      --
      Ubuntu is an African word meaning 'I can't configure Debian'
  26. VBScript and/or PowerShell by blincoln · · Score: 2

    VBScript is included with any version of Windows you're likely to be working with, is mature, and stable. That having been said, it has the boneheaded pre-.NET Visual Basic syntax, so you may hate yourself for choosing it.

    PowerShell is either included with or available as an add-on for most versions of Windows you're likely to be working with. It has a much nicer syntax that is inspired by several Unix/Linux scripting languages, and can make use of .NET assemblies, which is *very* powerful. However, my experience with it was that it wasn't 100% ready for primetime. I've written hundreds of VBScripts, but before I'd hit ten PowerShell scripts, I ran across a nasty bug related to one of the wildcard syntaces (is that even a word?) that the language supports - if I tried to use a for loop to iterate through a list of directories, and any of the directory names included square brackets, I was basically out of luck. There had been a workaround in older versions of PS, but not in the one I was using. Maybe MS eventually fixed this, but if so it literally took years.

    In an ideal world, I'd recommend PowerShell, because it can do a lot more, and typically with less script code. But I play it safe by sticking with VBScript, at least until the issues with PS are worked out.

    --
    "...always new atoms but always doing the same dance, remembering what the dance was yesterday." -Richard Feynman
    1. Re:VBScript and/or PowerShell by shutdown+-p+now · · Score: 2

      VBScript is included with any version of Windows you're likely to be working with, is mature, and stable. That having been said, it has the boneheaded pre-.NET Visual Basic syntax, so you may hate yourself for choosing it.

      You don't need to use VBScript with Windows Scripting Host (which is what that thing is called). It also supports JScript out of the box, and if you value your sanity that's what you should use. It's not 100% conformant ECMA-262 implementation, but it's pretty close, and either way it's a much more powerful and readable language than VBScript.

      The general problem with WSH is that it's COM-based. If software you automate exposes COM interfaces (e.g. Visual Studio), then it's all good. But newer stuff often only has .NET-only APIs for those things, and WSH won't help you there.

    2. Re:VBScript and/or PowerShell by toupsie · · Score: 1

      Try -literalPath instead of -path to overcome this.

      --
      Strange women lying in ponds distributing swords is no basis for a system of government.
    3. Re:VBScript and/or PowerShell by lot3k · · Score: 1

      I've found that vbscript/WSH for automation in my environment, especially if anything is happening in a PE. I use powershell for all my tools and remote management, AD management. I personally love powershell, quirkiness aside I feel more at home inside of it because of it's BASH like nature, and the ease of .NET assembly usage is certainly welcome. On the subject of vbscript, it can be pretty frustrating at times, but you reach a point where you've got a pretty solid code base that you are able to easily recyle it. I agree though, I'd rather be able to do it all in powershell, but I don't thnk it's quite mature enough yet for that.

    4. Re:VBScript and/or PowerShell by trainwrek · · Score: 1

      We've had great success with Powershell. It is already head and shoulders above VBScript, and has great community support. Where it has a surprising challenge is documentation. For some reason, Microsoft treats Powershell like a step child. Every new enterprise service they roll out has Powershell support, but there's no documentation on Powershell itself. Compare that with .net and there's a stark contrast. MSDN is amazing. One would think that with such a successful product (it really is great), MS would get behind it more.

  27. Powershell by Anonymous Coward · · Score: 0

    That is all.

  28. Re:Don't do it... by snowgirl · · Score: 2

          Day 1) Walk in the door, optimistic about what can be done with this "Enterprise" platform.

        Day 2) Walk in the door, with a headache, hoping to find an answer for how to manage what were simple tasks under *nix.

        Day 3) Walk in the door. Sit down at your desk. Plant your head firmly on the keyboard and cry.

        Day 4) Walk in the door, rip your soul out of your chest, stomp on it, and throw it in the nearest recycle bin. Sit down at your desk, and wonder why in 4 days you can't find a valid answer to automation that was so simple under *nix.

        Day 5) Walk in the door. Sit down at your desk, and think about how miserable you are now that you're working on a Windows-only network. Leave 2 hours early, and drink away your pain at the nearest bar.

        The longer it goes on, the worse the pain gets, until you realize that you have a stash of cheap liquor and pot in your desk drawer, and you use more of both in one day than an entire fraternity use in a hard partying weekend.

    All of this is true. The answer Microsoft themselves came up with? Perl for Windows. There was also a horrible mess of garbage in CMD script that was the *nix equivalent to #!/usr/bin/perl ... so that we could run perl scripts from the command line without typing "perl scriptname.pl" first... it was about a good 25 lines of code...

    --
    WARNING! This girl exceeds the MAXIMUM SAFE standards established by the FDA for BRATTINESS
  29. IronPython by Anonymous Coward · · Score: 0

    I would have said Python alone, which has some pretty good cross-platform support, but IronPython also has access to the entire .NET platform.

  30. Re:Don't do it... by ace999 · · Score: 1

    And remember why you initially did your automation on *nix based platforms...

  31. ColdFusion integrates well with MS products by WebManWalking · · Score: 2

    You can pick up a free copy ("Developer Edition") of ColdFusion from Adobe. Then code CF pages that call cfspreadsheet or cfsharepoint. (If you're careful to avoid coding directly to Windows (drive letters, backslashes, etc), the spreadsheet code you write will also work with Unix equivalents via POI.) Then use ColdFusion Administrator > Debugging & Logging > Scheduled Tasks to schedule those pages. (That's the CF equivalent of cron.)

    Can't beat the price.

    1. Re:ColdFusion integrates well with MS products by Salvo · · Score: 1

      This sounds like it would be more trouble that it's worth.

      [Bad Analogy]
      It would be like using a Sledgehammer to hammer in a nail when you have a claw hammer in your other hand.
      The Claw Hammer may not be as easy to use as your Trusty Old Nailgun, but it's better than using the wrong tool completely.
      [/Bad Analogy]

      I wouldn't rely on Adobe for any workflow, the more vendors you get involved in your solution, the more likely you are to introduce incompatibilities and security holes.

    2. Re:ColdFusion integrates well with MS products by Prosthetic_Lips · · Score: 1

      "Can't beat the price."

      Except you are cheating. "Developer Edition" means that a developer can use it on his development machine all s/he wants, but in a production environment it should be licensed. If you are using it to run some things for yourself that aren't really considered "in production," I'd agree with you. But this sounds like a production monitoring / testing situation, which is a little gray (to me ... YMMV ... IMHO ... ).

      If you don't want to pay for CF, use a free option: Railo.

      I agree that CF is a great choice for web development, but a scripting engine? Seems like overkill.

    3. Re:ColdFusion integrates well with MS products by WebManWalking · · Score: 1

      Well, he did say "the automation required for a test system". So it doesn't seem like cheating at all. It seems like using the Developer Edition for exactly its intended purpose.

      As for overkill, that's a matter of personal preference, isn't it? Ask yourself, do you really WANT to learn POI/Java? External manipulation of Office products doesn't get any easier than CFML. Maybe a cross-platform, easy solution is exactly what Zubinix wants, worth the memory and CPU usage of running another server. And he'd also have it available for other automation uses, such as [also easy] DirectoryWatchers.

    4. Re:ColdFusion integrates well with MS products by Anonymous Coward · · Score: 0

      Wow, never thought I see a CF fan boy advocating its use for server automation.

      Don't bother with CF, if you want to install a language (instead of just using PowerShell or some such) then go for Python and the PyWin32 extensions.

    5. Re:ColdFusion integrates well with MS products by mgbastard · · Score: 1

      ColdFusion for systems management automation?? What the hell? that's so off-base, I'm offended. Whatcha going to do, install coldfusion on EVERY system you are going to automate? Bizarre.

      --
      Anyone seen my low uid? last seen 10 years ago while panning the #@$# out of Taco's 'web based discussion system'
    6. Re:ColdFusion integrates well with MS products by Anonymous Coward · · Score: 0

      I have to ask, does your car look like a website too?

      Find another hammer dude. The concept of installing a complete application framework (especially CF) for automation of server administration is well beyond stupidity, and doing so in any form of audited or regulated environment is asking for your walking papers -- as it should be. Be glad you don't get a suit as well.

    7. Re:ColdFusion integrates well with MS products by Anonymous Coward · · Score: 0

      Can't beat the price.

      Adobe's "free" promotions carry some stiff penalties if you're caught actually using them for work.

      Defiantly not worth the risk.

      It would be safer to pirate the software.

  32. Sadly, it's vbscript by Anonymous Coward · · Score: 1

    I've been down this road. vbscript is more than a little annoying, but you can count on it being there, and it knows about COM (which you'll also enjoy). Good luck.

  33. Best practices are best practices by onyxruby · · Score: 2, Interesting

    There's nothing fundamentally really that different from a management standpoint. The more you'll dive in the more your going to find that differences boil down to syntax. Your going to need to test your scripts, your going to need to have peer review, your going to need to use change control, maintenance windows and so on.

    There is absolutely no reason for your process to be any different on the Windows side than the Unix side, and if it is than your process needs to be rebuilt. Process should always be tool agnostic and your operating system is simply a tool. If you know your best practices than the only thing you need to figure out is the syntax (tool, language etc) to do what you want to do.

    If your simply asking what tools you should use to do scripting or deployment, than you need to look at tools like Altiris, SCCM and so on. If your looking for tools for packaging applications than you would at tools like Wise Packaging Studio. What you really haven't done is explained your need very well. Are you trying to manipulate certain things about exchange with a script? Are you trying to export or import SQL database data with your script?

    If you want to run a script on just a few systems than you can schedule the server to run scripts manually and you just need to supply the scripts. If your looking to deploy something on a consistent basis than a combination of GPO's and Active Directory can work quite well. If your looking to automate the distribution of a series of scripts based on certain characteristics of your systems than it would be hard to beat Altiris. If you want to run custom queries or actions than WMI based scripting can do some pretty neat things.

    Feel free to message me offline, where I work I'm responsible for the management of both Windows and Mac based systems and do this for a living on a daily basis.

    1. Re:Best practices are best practices by Zubinix · · Score: 1

      What you really haven't done is explained your need very well

      The role is rather adhoc. I could be scripting some testing processes that move files around and import into databases or I could be adding features to Outlook...for example a simple timesheet and leave application interface that would send leave requests to the appropriate manager. Being able to quickly prototype something is essential here.

    2. Re:Best practices are best practices by 1000101 · · Score: 1

      SharePoint has basic workflow functionality out of the box. If you're looking for simple timesheet and leave application requests that route tasks to managers then don't kill yourself writing custom scripts. Those types of applications can be built in no time with standard SharePoint lists/calendars and approval workflows

    3. Re:Best practices are best practices by Anonymous Coward · · Score: 0

      Your bad at grammar

    4. Re:Best practices are best practices by Anonymous Coward · · Score: 0, Flamebait

      YOU ARE
      YOU ARE
      YOU ARE = YOU'RE
      YOU ARE != YOUR

      For fuck's sake, it's not that fucking hard. Not once, not twice, but EVERY SINGLE FUCKING TIME you got it wrong. That's beyond a typo, that's pure fucking ignorance and stupidity. Do you really not know the fucking difference? Why would anyone take your advice if you can't get such a simple thing right? Honestly, I'd prefer the hundreds of other retarded "Durr Windows is sucks lol hurr durr i wanna suck Linus' cock" posts than this fucking disgrace.

    5. Re:Best practices are best practices by Fierlo · · Score: 2, Funny

      I tried to ignore it... But best practices should know the difference between "your" and "you're"

  34. Bad luck by starfishsystems · · Score: 0, Troll

    Unless 100% of the applications that you need to integrate into your automation are driven by CLI or some kind of well-defined API, you'll be out of luck.

    Windows isn't designed for automation. It's designed for moronic pointing and clicking.

    --
    Parity: What to do when the weekend comes.
    1. Re:Bad luck by TrancePhreak · · Score: 1

      You can automate point & clicking on Windows.

      --

      -]Phreak Out[-
    2. Re:Bad luck by F-3582 · · Score: 1

      Luckily a growing portion of applications for Windows bring their own Powershell cmdlets for low-level access, nowadays. I was told that Office 2010 is basically a (huge) bunch of Powershell cmdlets and the GUI just wraps around them.

    3. Re:Bad luck by starfishsystems · · Score: 1, Insightful

      Just not meaningfully.

      --
      Parity: What to do when the weekend comes.
    4. Re:Bad luck by starfishsystems · · Score: 1

      Let me know when it's done. It's a very good idea, but I won't hold my breath.

      None of the "enterprise class" applications I use have a hope of that unless the vendor undertakes to rewrite them from the bottom up.

      --
      Parity: What to do when the weekend comes.
    5. Re:Bad luck by Anonymous Coward · · Score: 1

      You, sir, have never been a windows admin, or if you were, you were not worth what they were paying you. Everything that needs to be done can be automated with windows, from the install processes to updates. User logs in, software runs from network share, does what is needed, period. CLI or no. If its really some ass backward program that only works via the GUI, then you run the software on a test bed, use any of the dozens of programs that record keystrokes, had the users log in and when they do, the system stops accepting input from the user end, the pre-compiled, pre-recorded script runs, does what is needed, and returns control to the user. Never had to actually do that, but it can be done.

      That having been said. PowerShell. Learn it. Live it. Love it. Its an OO shell scripting language with access to the system at just about every level that matters.

    6. Re:Bad luck by Anonymous Coward · · Score: 0

      nearly every new major app from MS supports Powershell. Indeed a lot of the managment tools now actually get the ps cmdlets designed first, and then the actual UI wrapped around them.

      your clearly ignorant of windows server apps over the last few years.

    7. Re:Bad luck by spongman · · Score: 1

      actually office has been automatable via its COM/OLE API since around '93 when VBA first came out.

    8. Re:Bad luck by Anonymous Coward · · Score: 0

      There are programs like SilkTest and Sikuli that do the job pretty well and easily.

      OK, Sikuli failed horribly when I tried it a year ago, especially since it is matching what is on the screen and that isn't very portable across WindowsXP -> Win2k3 -> Vista -> Win2k8 -> Win7 (without major work).

      SilkTest was nice, except that how it works with .NET applications conflicted with what I was testing and it injected dll files in, which crashed my program.

      This is why I basically said, "Screw you Windows, I'm going back to linux". It was just a waste of time having to fight against all of that.

  35. Let me translate the /. replies so far... by Anonymous Coward · · Score: 2, Informative

    "I am a one trick pony who cannot learn to do things in other operating systems because my ego gets in the way."

    Go elsewhere to seek advice. I'd suggest stackoverflow.com

    1. Re:Let me translate the /. replies so far... by mrjb · · Score: 1

      I don't think I'd be able to survive windows anymore without unxutils. No, mr. Troll, that has nothing to do with being a one-trick pony; it just so happens that UNIX-like skills tend to port well across OS platforms. It would be silly and a waste of time to throw all those skills right out of the window just to re-learn to do the same thing, but this time in a non-portable fashion. Also, I happen to like grep and all the other tools that Just Work.

      --
      Visit http://ringbreak.dnd.utwente.nl/~mrjb/growingbettersoftware to download your free copy of the book
    2. Re:Let me translate the /. replies so far... by Anonymous Coward · · Score: 0

      uhm, yours is the only negative comment I see not giving valid advice. Perhaps you shouldn't read slashdot with a -1 comment threshold?

    3. Re:Let me translate the /. replies so far... by 1s44c · · Score: 1

      "I am a one trick pony who cannot learn to do things in other operating systems because my ego gets in the way."

      Go elsewhere to seek advice. I'd suggest stackoverflow.com

      The thing is UNIX guys get used to computers doing what they are told. It's hard to get used to windows doing 97% of what it's told on a good day and way less on a bad day. Many people will deny it but windows is still flaky and not well suited to complex automation.

  36. Re:Don't do it... by spacecowboy420 · · Score: 1

    Yeah, on linux it was:
    Day 1) Find autoexpect, leverage that with some bash/perl/python/tcl etc foo
    Day 2) Done

    --
    ymmv
  37. Re:Don't do it... by RobertM1968 · · Score: 1

    Just don't. [/notsarcasm]

    FTFY! ;-)

  38. Re:autoit- THIS! by j-stroy · · Score: 1

    Got into Autoit on a recent project. Definitely a good implementation. Did what I wanted completely. I was calling Autoit into and out of Maya (3D) scripts, chaining it all together. Was able to wait and timeout on specific Maya exporter dialogs and trap contingencies. There was a little funny business with different ways of accessing the windows controls, but not too hard, just ganked code from some demos.

  39. Use automation for automation by Anonymous Coward · · Score: 2, Informative

    Use a decent automation engine, will save you years of headaches and maintenance. There are pros and cons though.

    Ones such as BMC Bladelogic or HP Server Automation (opsware) are probably the best out there (enterprise-grade).

    Be forewarned: they are not cheap. Best for enterprises 100+ systems. The more, the better ROI.

    1. Re:Use automation for automation by lucm · · Score: 1

      Opsware (now HP Operations Orchestrator) is just awesome. Besides lots and lots of plugins and templates it has a very cool feature which allows you to create a new workflow item based on a web service signature (WSDL).

      --
      lucm, indeed.
    2. Re:Use automation for automation by Anonymous Coward · · Score: 0

      Having deployed both in an enterprise, I can say that if you're trying to automate imaging, go with Bladelogic. If you're trying to automate package deployment/policy, go with HPSA. Bladelogic has a great feature - it has a custom PXE server that keeps track of the state of the OS install, and changes the boot so that you can set your servers to network boot, and once they're installed, Bladelogics PXE server will make it us the HDD. This is fantastic, compared to HPSA where you need to dink around to make things happy.

      ymmv

    3. Re:Use automation for automation by batzo · · Score: 1

      Having deployed both in an enterprise, I can say that if you're trying to automate imaging, go with Bladelogic. If you're trying to automate package deployment/policy, go with HPSA. Bladelogic has a great feature - it has a custom PXE server that keeps track of the state of the OS install, and changes the boot so that you can set your servers to network boot, and once they're installed, Bladelogics PXE server will make it us the HDD. This is fantastic, compared to HPSA where you need to dink around to make things happy.

      ymmv

      HPSA does this too, you just need the MBC extension...

  40. Powershell by technoviper · · Score: 3, Insightful

    Stay away from VBScript, its very out of date at this time. Best work with Powershell, it has deep integration into Active Directory and Exchange (as well as OS, WMI etc). Its quite simple to get a script up and running, and its widely supported. It comes built into the OS in Windows 2008 onwards, for 2003 its available as a download.

  41. OLE Automatisation by Casandro · · Score: 2

    One possible way is OLE automatisation, but be prepared of the horrors of it.

    1. Re:OLE Automatisation by shutdown+-p+now · · Score: 1

      OLE Automation is a set of general-purpose scripting extensions on top of COM - defining various interfaces that permit dynamic dispatch, RTTI and other such things. It doesn't actually have anything to do with automation as such, except that it used to be the preferred way for applications to expose automation APIs should they have any - so whether there are any "horrors" involved or not, or whether there is any support at all, depends entirely on the application.

      This is now superseded by PowerShell, in any case.

  42. Python? by Bazman · · Score: 1

    With the win32api module, can do Windowsy stuff, and you can transfer all your python skills from your Unix days. You do have Python skills don't you? Well, get some.

    There's a native port of Python so no need for cygwin.

    1. Re:Python? by Anonymous Coward · · Score: 0

      If you are going to use a *nix language why bother with a crappy one like Python? You can just use something sexy like Perl.

  43. Don'ts by stewbacca · · Score: 4, Informative

    Don't get your hopes up with Sharepoint. This is quite possibly the single worst piece of crap ware I've encountered in the past 2 years.

    1. Re:Don'ts by Anonymous Coward · · Score: 0

      I ditto that!

    2. Re:Don'ts by Anonymous Coward · · Score: 0

      I can't believe this was upvoted as "Informative". At any rate, SP 2010 can be automated/scripted with PowerShell. 2007 you can use STSADM to some extent.

    3. Re:Don'ts by Anonymous Coward · · Score: 0

      Don't get your hopes up with Sharepoint. This is quite possibly the single worst piece of crap ware I've encountered in the past 2 years.

      And how does this blithering nonsense rank a 5?

    4. Re:Don'ts by Anonymous Coward · · Score: 0

      I don't think stewbacca was talking about automating it. He was talking about the software itself.
      And I agree that it is a piece of crap.

    5. Re:Don'ts by Toreo+asesino · · Score: 2

      SharePoint 2010 can be automated quite nicely in powershell. Thanks for the insight though.

      --
      throw new NoSignatureException();
    6. Re:Don'ts by Anonymous Coward · · Score: 0

      Oh, you could not figure it out!

  44. I have to promote Microsoft products... by Anonymous Coward · · Score: 5, Funny

    Hey I'm a smiley kind of guy and I have to promote Microsoft products to undermine *nix and expand our market share, but I'm afraid I'm running out of ways to do it.

    I wondered if the ever so friendly and clever Slashdot crowd can think of imaginative ways to carry out this task? Please help me. Remember; I think you're wonderful.

    1. Re:I have to promote Microsoft products... by Anonymous Coward · · Score: 0

      Good point. Great inverse troll bait! Can anyone point out some solid ways to do such automation stuff with Linux and COTS hardware? Between DB25/parallel, Joystick ports and serial ports (USB too!) can anyone recommend good Linux centric approaches? Am a KSH guy,but it doesnt seems the best fit for automation tasks.

    2. Re:I have to promote Microsoft products... by Anonymous Coward · · Score: 0

      Considering the number of friendly MS answers, I'd say you succeeded. Every linux and mac slashdotter seems to be dead.

    3. Re:I have to promote Microsoft products... by Anonymous Coward · · Score: 0

      Just bring back Clippy, the super-helpful paperclip! Surely he can answer all your questions.

  45. Lets look at the situation by Anonymous Coward · · Score: 1, Insightful

    Lets look at the situation. You have the Unix shell (C, Korn, Bourne, Bash, etc), designed over long periods to offer universal functionality and complete environmental control. You can control processes in detail. You can integrate seamlessly and universally with every application on the box, and are given more control and more options than the graphical user interface. The shell scripting languages offer logic and control structures consistent with Turing Complete languages. There is nothing equivalent, or even close in the windows world. There are some 3rd party applications that may attempt to do scripting, but they are all after the fact. Windows was never designed as a 'back end' system. Their offerings offer limited functionality, since its all after the fact. Part of the issue is that its almost universal that every application that has a graphical user interface in Linux or Unix, also has a non-graphical interface integrated and designed as part of the application. Many windows applications don't have that functionality (all user control over the application is graphical, all output is graphical, except to very specific parts areas of the operating system, there is rarely any back-end command and control that a scripting language can do anything with). Shorter answer: you are going from a richly endowed system to a very sparse one. You are already in trouble.

    1. Re:Lets look at the situation by causality · · Score: 1

      Lets look at the situation. You have the Unix shell (C, Korn, Bourne, Bash, etc), designed over long periods to offer universal functionality and complete environmental control. You can control processes in detail. You can integrate seamlessly and universally with every application on the box, and are given more control and more options than the graphical user interface. The shell scripting languages offer logic and control structures consistent with Turing Complete languages. There is nothing equivalent, or even close in the windows world. There are some 3rd party applications that may attempt to do scripting, but they are all after the fact. Windows was never designed as a 'back end' system. Their offerings offer limited functionality, since its all after the fact. Part of the issue is that its almost universal that every application that has a graphical user interface in Linux or Unix, also has a non-graphical interface integrated and designed as part of the application. Many windows applications don't have that functionality (all user control over the application is graphical, all output is graphical, except to very specific parts areas of the operating system, there is rarely any back-end command and control that a scripting language can do anything with). Shorter answer: you are going from a richly endowed system to a very sparse one. You are already in trouble.

      Somebody please mod this up. Parent summed up the design and cultural differences in an intelligent way without resort to "M$ is tha sux0rz lolz".

      --
      It is a miracle that curiosity survives formal education. - Einstein
    2. Re:Lets look at the situation by PPH · · Score: 1

      Somebody please mod this up.

      I second the motion. I'm down to my last few clips of mod points at the moment.

      This is exactly my experience with the Windows model. It was just never designed with autonomous machine to machine processing in mind. On the positive side: SkyNet will never get past waiting for some human to click on the appropriate 'Cancel or Allow' button in a Windows world.

      --
      Have gnu, will travel.
    3. Re:Lets look at the situation by MightyMartian · · Score: 1

      I third it that motion. I am constantly running up against problems in automating functionality in Windows that is a bloody snap in *nix. And it isn't just Windows, the whole philosophy of "GUIs are better" invades their product line. I spent a day trying to make the Intelligent Message Filter in Exchange 2003 do something vaguely like real message filtering, the way that I can do it in Postfix, and I realized at some poin that Microsoft's system engineers just don't get it. It's not a case of stupidity, because they've got to be really bright guys, but they just don't understand the needs of someone administering servers, the need to have a powerful and simple-to-use automation tools.

      You'll find Windows guys mocking the Bourne shells, but that's only because they're either jealous or too fucking ignorant to see that *nix had constructed a powerful toolset for automating any task possible while Bill Gates was still trying to figure out ways to rip off CPM.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    4. Re:Lets look at the situation by Glendale2x · · Score: 1

      Seconded, thirded, or sixthed...

      And based on the crazy ass examples of PowerShell I've read in other comments, C, Korn, Bourne, Bash, etc. seem to be much more user friendly. (I never thought I'd say that about the unix shell.)

      --
      this is my sig
    5. Re:Lets look at the situation by Anonymous Coward · · Score: 0

      The shell scripting languages offer logic and control structures consistent with Turing Complete languages. There is nothing equivalent, or even close in the windows world.

      Nice piece of trolling mate! You even manage to get through with a 5, Insightful :-D

    6. Re:Lets look at the situation by SomeStupidNickName12 · · Score: 1

      Haha, buddy you should make sure your knowledge of the windows server environment is current before running off with rants like that. Everything in windows can be done via powershell interacting with .net/com/wmi. To a competent sysadmin/developer powershell makes bash look like the dos command shell's stupid cousin.

  46. Multiple tools by Anonymous Coward · · Score: 0

    Dos Batch Scripts (.bat & .cmd) SETLOCAL is your friend.

    AutoIT (script gui programs!)
    http://www.autoitscript.com/site/autoit/

    Unix Utilities (deploy if you can)
    http://unxutils.sourceforge.net/

    Also remember that in dos:
    find /i "thing I want to look for" *filenames*
    works a lot like a weak version of grep.

    Also look into windows powershell (I have not used it but the internet says it's awesome so it must be true.)

    Also a lot of windows programs have command line options or programs you can leverage. You can build an entrire AD domain from the command line if you use the appropriate methods.

  47. WRONG WAY by Anonymous Coward · · Score: 0

    TURN BACK

    (Sign you see in UK&Ireland when you get off the ferry on the wrong side - they drive on the left)

  48. Powershell and other tools by thalakan · · Score: 5, Informative

    Powershell. The only tool that knows how to talk to all the different frameworks in Windows is Powershell. No other tool can talk to .NET, COM, WMI, native APIs (via P/Invoke), and external stdio based tools. If you can't do the automation you want using something in one of the above frameworks, you've got bigger problems than finding a good automation tool.

    Since the test guy usually has to be a part time sysadmin too, you should be aware of these tools:

    System update readiness tool: http://support.microsoft.com/kb/947821/en-us
    WMI diagnostic utility: http://www.microsoft.com/downloads/en/details.aspx?familyid=d7ba3cd6-18d1-4d05-b11e-4c64192ae97d&displaylang=en
    gplogview: http://www.microsoft.com/downloads/en/confirmation.aspx?familyId=BCFB1955-CA1D-4F00-9CFF-6F541BAD4563
    Windows SDK (including debugging tools for windows): http://www.microsoft.com/downloads/en/details.aspx?FamilyID=35AEDA01-421D-4BA5-B44B-543DC8C33A20
    ollydbg: http://www.ollydbg.de/
    sysinternals suite: http://technet.microsoft.com/en-us/sysinternals/bb842062
    Windows Management Framework: http://support.microsoft.com/kb/968929
    WDK: http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=36a2630f-5d56-43b5-b996-7633f2ec14ff
    WAIK: http://www.microsoft.com/downloads/en/details.aspx?familyid=696DD665-9F76-4177-A811-39C26D3B3B34&displaylang=en
    Windows 7 SP1 WAIK supplement: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=0AEE2B4B-494B-4ADC-B174-33BC62F02C5D

    If XP is involved, check out Windows SteadyState. It's like deepfreeze, if you've ever used that. qemu is also a great way to boot test machines and capture output at scale; using CoW disks you can have fresh machines every time you boot regardless if the test machines are XP or not.

    --
    -- thalakan
    1. Re:Powershell and other tools by Zubinix · · Score: 1

      Lots of useful info at those links. Thanks!

    2. Re:Powershell and other tools by Anonymous Coward · · Score: 0

      Perl Will interface into WMI and COM. Plus the OP has a familiarity with Perl.

      Just get ActiveState perl.

    3. Re:Powershell and other tools by Anonymous Coward · · Score: 0

      After to much trouble and infight trying fix our internal powershell coding practices (we are a it-admin outsourcing and consulting firm) we ended replacing powershell with custom delphi made executors (derived from the opensource MaxBox delphi-script interpreter) with turtle subversion integration... powershell falls short of his promises, its so full of short commings and special cases that breaks any sane standart on varied enought use cases

      http://www.softwareschule.ch/maxbox.htm

    4. Re:Powershell and other tools by Anonymous Coward · · Score: 0

      I'm an old-time Unix bigot who eventually decided it was impractical for me to be ignorant of Windows.

      This guy's right. PowerShell is excellent. It fits naturally around Windows OS and apps, and it's not a slavish imitation of Unix shells. But it was written by experienced people who really 'got' the Unix environment.

    5. Re:Powershell and other tools by Anonymous Coward · · Score: 0

      I also recommend Russinovich's tools (psexec, psloglist, procmon, etc.) Super duper handy.

    6. Re:Powershell and other tools by Anonymous Coward · · Score: 0

      How the he** does one us anything "like deepfreeze" to script anything on a Windows machine?

  49. Python by motek · · Score: 1

    I tend to do this king of stuff (automated test harnesses) with Python (equipped with necessary platform-specific libraries). Naturally, this is Windows so COM and WMI are your friends. Note that IPython makes for an excellent shell for trying stuff out. I tend to go back and forth between Linux and Windows and Python definitely is a transferable skill.

    --
    I would like to die like my grandfather did - sleeping. And not screaming in terror, like his passengers.
  50. autoit? by Anonymous Coward · · Score: 0

    Haven't used it myself, but I've seen it mentioned in regards to unit testing on windows - http://www.autoitscript.com/site/autoit/
    Did I miss this in the comments or has no one suggested it? (perhaps it's not really geared for what you're doing)

  51. Re:From unix to windows.... by Anonymous Coward · · Score: 1

    I have zero experience with powershell, but it seems like you're saying it's a quick, painless solution.

  52. Re:Don't do it... by lucm · · Score: 4, Interesting

    I don't agree. Powershell is actually very powerful as it can extend or be extended by the .Net framework. It is also very flexible, which is very convenient for systems automation.

    Big enterprise schedulers, such as Tidal, have built-in support for Powershell and many enterprise storage solutions, such as Compellent, also have built-in support. Also VMWare has the very impressive PowerCLI, which is basically a series of extensions for Powershell that can automate almost everything in VirtualCenter.

    --
    lucm, indeed.
  53. Opalis by Anonymous Coward · · Score: 0

    Why not give Opalis a try? It's actually really easy. PowerShell is more powerful, but it's not exactly intuitive.
    http://www.microsoft.com/systemcenter/en/us/opalis.aspx

    Good luck.

    1. Re:Opalis by It+took+my+meds · · Score: 1

      I've done training on Opalis. There are currently quite a few limitations with the software that we discovered through the training:

      - We encountered a lot of issues with the software and there was also a lack of documentation. Basically I wouldn’t consider the software to be up to normal production standard yet.

      - It can be quite cumbersome to put together complex workflows with Opalis for a number of reasons, some of which include:
              * The criteria for which path to take don’t include any “else” option, so if you want to take separate paths then you have to define the criteria multiple times and ensure yourself that the criteria on one and only one path will be correct.
              * Often workflows start by monitoring for something to happen, e.g. a job of a particular type to be created in the service desk product. The problem is that if the thing you are monitoring for happens while your policy isn’t running (because something went wrong, the server was being rebooted or any other reason) then it will miss that instance and won’t ever trigger for that case.
              * Opalis allows you to embed scripts, .Net Code and SQL statements in various locations. However, it has no way to avoid attacks such as SQL injection attacks where you use variables within that code that come from an untrusted source.
              * It isn’t possible to understand what the elements of an existing workflow do without clicking on them and checking all of the properties for each one and for all of the links.
              * Workflows can’t include long-term actions like waiting for approval that might take a few days because if a workflow is terminated in the middle (e.g. because the server running the workflow is patched and rebooted) then no state is saved and the task that the workflow was performing will simply disappear.

      I don’t consider the licensing for Opalis to be particularly friendly because it only comes as part of various bundles from Microsoft. This is great if you already have the System Centre bundle for all your severs because then you get Opalis for free, but not so great if you don’t.

  54. What versions? by CannonballHead · · Score: 1

    Are you talking about 2008 and Windows 7? Or do you need to go back to Windows 2000, XP, or even 2003? There are significant differences in the tools available based on the version (for example, powershell...)

    1. Re:What versions? by Zubinix · · Score: 1

      I would imagine Windows XP and later.

  55. Opalis by lucm · · Score: 1

    Have a look at Opalis, which has been acquired by Microsoft and is now part of the System Center suite. It is a very interesting runbook automation environment with plugins for most Windows-related tasks. It is graphical and pretty user-friendly, and if something cannot be done natively you can extend it with Powershell.

    --
    lucm, indeed.
  56. So sorry by SnarfQuest · · Score: 1

    Whatever you do, expect it to break on you because of:
    1. Microsoft update
    2. Adobe update.
    3. Java update.
    4. A field overflow deep within Windows.
    5. Random licensing failure.
    6. Some random app crashes.
    7. Someone on the network updated their version of Word, causing your database access to fail.
    8. Hackers.
    9. Virii ...

    And, it will probably takes weeks to find the problem and then get it working again, for a little while.

    --
    Who would win this election: Andrew Weiner vs Andrew Weiner's weiner.
    1. Re:So sorry by 1s44c · · Score: 1

      10. Random API failures or APIs that don't behave to spec.
      11. Interference from virus scanners. ...

      SnarfQuest is right. Automation will break often and in weird ways, it's going to require constant maintenance.

  57. Maybe try this? by Anonymous Coward · · Score: 0

    http://www.csscript.net/

  58. List... by frank_adrian314159 · · Score: 1, Troll

    Is there a list of should and should not dos when it comes to Windows automation?

    Yes.

    1. Do not do Windows automation.

    That is all...

    --
    That is all.
  59. For COM, use COM tools by Anonymous Coward · · Score: 0

    VBScript and "jscript", along with the Windows Script Host, are designed for COM automation. Most of what you need in that case can be found in the script56.chm file.

    http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9

    Perl is not COM-oriented, of course, but can be adapted if you prefer. .Net is not primarily COM, so it doesn't make much sense unless you already know .Net and like it. Some have suggested WMI. WMI is not script. It's a set of classes that can be used through script -- typically used with VBScript. For most things other than hardware information, WMI is just a clunky, slow wrapper, while the syntax is ugly and unintuitive.

  60. Go with Perl by Anonymous Coward · · Score: 0

    I've written complex tests (1000's of lines) in perl which run on Windows, Linux, AIX, and Solaris. In my case I'm both Unit testing software changes, and regression testing before submitting into fhe code base.

    A lot of the tests at our company are written in perl because most of the perl code works on all the platforms we ship our product on. Most of our core product is written in C.

  61. Go sharpen up a spoon by steelwraith · · Score: 0

    so that you can give yourself a pre-frontal lobotomy to bring yourself down to Windows level...

  62. AutoIt by PhilHibbs · · Score: 1

    AutoIt is brilliant, I've had a lot of fun with it. Some people like AutoHotKey, but I can't get used to the syntax. I'm dabbling with MacroMonkey which looks like it can do a lot of the same stuff with a better language (Lua) but not as well-developed a library and nowhere near the same community as AutoIt (although there are some very abrasive personalities on the forum).

  63. It is not about scripting alone by octogen · · Score: 1

    This is a more complex problem than what scripting language you are going to use. Automating things is about job management, process management, signals, connecting streams and terminals, setting device modes, filesystem permissions, modifying network settings, and many other things. Unix is designed in a way that lets you change almost every property of the system in numerous ways, following general principles of its architecture. It is a very logical and consistent system.

    The problem is that Windows lacks such an modular, abstract foundation. It is a much more arbitrary and inflexible system, it is not designed for putting different pieces of it together in different ways for automation.
    For example, on Unix you have numerous small utilities that work together nicely by piping the output of one utility into the input of another one. Windows is really bad at doing such things, and the output format of most of its utilities is not easily machine parseable.

    I think, the question is not: How do I automate Windows? The question should be: What system should I use, which one is good at automation?
    And the answer is definately Unix, not Windows.

    1. Re:It is not about scripting alone by benjymouse · · Score: 2

      This is a more complex problem than what scripting language you are going to use. Automating things is about job management, process management, signals, connecting streams and terminals, setting device modes, filesystem permissions, modifying network settings, and many other things.

      Agreed. And that is what PowerShell excels at - on the Windows platform.

      Unix is designed in a way that lets you change almost every property of the system in numerous ways, following general principles of its architecture. It is a very logical and consistent system.

      Yes, bit the fact that Unix same up with this good idea 30 years ago does not mean that it is *the only* such system or even that the *nix way of doing things cannot be improved upon.

      The problem is that Windows lacks such an modular, abstract foundation.

      Are you for real? Have you any idea about Windows foundation? Unlike Unix, Windows' foundation is almost exclusively object-oriented. Most/all core API are exposed through COM which is an object-oriented foundation which allow much finer-grained access than command-line utilities and text file fiddling.

      It is a much more arbitrary and inflexible system, it is not designed for putting different pieces of it together in different ways for automation.

      Read up on PowerShell. PowerShell works with COM, WMI and .NET and thus can reach any part of the system and all applications which expose automation APIs or which is based on .NET.

      For example, on Unix you have numerous small utilities that work together nicely by piping the output of one utility into the input of another one. Windows is really bad at doing such things, and the output format of most of its utilities is not easily machine parseable.

      But those "small utilities" are really small monoliths. You cannot interact with them as they run expect through the input stream. You spawn them and listen for their output. Compare that to PowerShell manipulating objects. As an example just consider the ps command. In PowerShell it returns not text but a collection of Process objects, each describing the process. These objects can be piped through other cmdlets which can call methods on those objects, like e.g. Refresh, Kill, WaitForExit or drill down into threads or handles, all from the returned object. With Unix you have to ask the utilities to output in a certain format or use entirely separate utilities.

      Consider for example why ls has so many options for controlling output (I list here only the options for somehow controlling the output format and/or sorting):

      man ls

      (a lot of options)

      Now, is that a simple utility? I can count some 50+ formatting/sorting options in this command alone. Why does a command which is supposed to list files and directories have so many options for controlling the output format? Is it to please cranky sysadmins who will only accept to view listings in a specific format, or is to to adapt to the requirements of other commands? The constant formatting and parsing is error prone and thus commands now include options to make sure that e.g. dates can be formatted and parsed in a way as to avoid strange effects when run in a different environment.

      After that consider ps which has it's own set of options for controlling output to allow for further processing. Why do all commands have to be concerned about this, often using conflicting concepts and option names? How is this "do one task only and do it well"?

      Then look at PowerShells ls command (alias for Get-ChildItem):


      PS> get-help ls

      NAME
      Get-ChildItem

      SYNOPSIS
      Gets the items and child items in one or more specified locations.

      SYNTAX

      --
      Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
  64. Old but good one by xPertCodert · · Score: 1
  65. Re:Don't do it... by Anonymous Coward · · Score: 2, Informative

    Mouse click away you say? AutoIt

    I prefer *nix too but I have a lot of Microsoft shops that I take care of. AutoIt has saved me a lot of time and effort.

  66. Re:From unix to windows.... by Anonymous Coward · · Score: 0

    Not quite: if you perform the second option correctly, the pain and misery will be over quickly. ;)

  67. Powershell is a Winner by Anonymous Coward · · Score: 0

    Powershell can be installed on XP/Server 2003 and Vista/2008 and Powershell V2 comes by default in Windows 7 and is a built in optional feature in Server 2008 R2, so it is available on all modern Windows OS'.

    There is pretty much nothing you can't do in Powershell. It has an innovative object pipeline system and excellent syntax. The learning curve is high but what powerful programming language doesn't have a high learning curve?

    Want to construct a 'magic packet' and send it over the network? No problem: http://powershell.com/cs/blogs/tips/archive/2011/02/24/sending-magic-packet.aspx

    Want to automate SharePoint? http://www.u2u.info/Blogs/karine/Lists/Posts/Post.aspx?ID=9

    Want to automate Exchange? http://technet.microsoft.com/en-us/library/bb124413.aspx

    Want to read a binary file? Get-Content -Path C:\binary.file -Encoding Byte

    Want to connect to a web service? http://technet.microsoft.com/en-us/library/dd315258.aspx

    Want to query a SQL database? http://thepowershellguy.com/blogs/posh/archive/2008/02/28/listing-all-the-databases-from-a-sql-server-from-powershell.aspx

    Want to construct a GUI? http://technet.microsoft.com/en-us/library/ff730941.aspx

    Want to convert a bitmap to a GIF? http://blogs.technet.com/b/heyscriptingguy/archive/2010/07/05/hey-scripting-guy-how-can-i-use-windows-powershell-to-convert-graphics-files-to-different-file-formats.aspx

    Want help from the Powershell community? http://www.powergui.org/forumindex.jspa?categoryID=55

    Want to search a repositiy of pre-made scripts? http://poshcode.org/

    Need help with a script? http://www.powergui.org/forum.jspa?forumID=165

    And the list goes on and on and on and on....

    1. Re:Powershell is a Winner by Daniel+Phillips · · Score: 1

      Want to read a binary file? Get-Content -Path C:\binary.file -Encoding Byte

      Wow, that is powerful! Contrast with the same thing, much more difficult to express in Unix:

            cat [filename]

      [/sarcasm]

      --
      Have you got your LWN subscription yet?
    2. Re:Powershell is a Winner by MightyMartian · · Score: 3, Insightful

      There is pretty much nothing you can't do in Powershell. It has an innovative object pipeline system and excellent syntax. The learning curve is high but what powerful programming language doesn't have a high learning curve?

      bash...

      Probably the hardest thing to learn in the *nix scripting world is sed.

      I wrote a menuing system for a Xenix minicomputer back in the early 1990s in straight sh, never having touched it or the Unix tool set before, in a couple of hours. And I can tell you I ain't no genius.

      Try do anything vaguely useful in Powershell without prior knowledge in a couple of hours. It is a gawdawful horror story, a good example of the insane overkill that Microsoft applies to simple problems. It keeps the MCSE's employed with the bizarre range of esoteric and overly-complicated solutions, but when you're just trying to move some data around from tool to tool or piping some output through a regex evaluator on its way to a SQL RDBMS, you end up going "What the fuck is wrong with those people in Redmond?"

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    3. Re:Powershell is a Winner by Cico71 · · Score: 1

      Want to read a binary file? Get-Content -Path C:\binary.file -Encoding Byte

      Wow, that is powerful! Contrast with the same thing, much more difficult to express in Unix:

      cat [filename]

      [/sarcasm]

      Don't worry, we are also lazy:
      Get-Alias -Definition Get-Content

      Alias cat Get-Content
      Alias gc Get-Content
      Alias type Get-Content

      ;-)

    4. Re:Powershell is a Winner by Cico71 · · Score: 2

      There is pretty much nothing you can't do in Powershell. It has an innovative object pipeline system and excellent syntax. The learning curve is high but what powerful programming language doesn't have a high learning curve?

      bash...

      Probably the hardest thing to learn in the *nix scripting world is sed.

      I wrote a menuing system for a Xenix minicomputer back in the early 1990s in straight sh, never having touched it or the Unix tool set before, in a couple of hours. And I can tell you I ain't no genius.

      Try do anything vaguely useful in Powershell without prior knowledge in a couple of hours. It is a gawdawful horror story, a good example of the insane overkill that Microsoft applies to simple problems. It keeps the MCSE's employed with the bizarre range of esoteric and overly-complicated solutions, but when you're just trying to move some data around from tool to tool or piping some output through a regex evaluator on its way to a SQL RDBMS, you end up going "What the fuck is wrong with those people in Redmond?"

      Just as a reality check, here's a single command line that:

      - gets the Windows security Event Log
      - filters for failed logon events (4648)
      - extracts some fields from the events, in some cases these are exposed as simple properties of the streaming objects, in one other it's using RexEx, with a named capturing group, to find the user name in the message
      - inserts the data in a SQL RDBMS

      Get-EventLog -LogName "Security" | ? { $_.InstanceID -eq 4648 } | Select Index, TimeGenerated, MachineName, @{Name="AccountName"; Expression={(([regex]"Account Name:\s*(?.*)\x0d\x0a").Match($_.Message) | ? {$_.Success}).Groups['AccountName'].Value}} | % { Invoke-Sqlcmd -Query "INSERT INTO tempdb.dbo.FailedLogons VALUES ($($_.Index), '$($_.TimeGenerated)', '$($_.MachineName)', '$($_.AccountName)');" }

      I'm no genius either, have no MCSE, been into Xenix last century, but oddly enough I ended up with a completely different opinion of the people in Redmond.

      Just to be sure I'm not making up things, this is the database schema to test it with SQL Server:
      CREATE TABLE tempdb.dbo.FailedLogons ( LogIndex int NOT NULL PRIMARY KEY , TimeGenerated datetime NOT NULL , MachineName nvarchar(16) NOT NULL , AccountName nvarchar(256) NOT NULL )
      Oh, and you need to make sure SQL Server PowerShell provider is loaded in your environment for the Invoke-Sqlcmd commandlet to be available.

    5. Re:Powershell is a Winner by Cico71 · · Score: 1

      And yes, these are not failed, but attempted logons.

    6. Re:Powershell is a Winner by emj · · Score: 1

      Can't you just add that "AccountName" variable in some way, or do you really need to use select to insert it into the "row".

    7. Re:Powershell is a Winner by jgrahn · · Score: 1

      Just as a reality check, here's a single command line that: - gets the Windows security Event Log - filters for failed logon events (4648) - extracts some fields from the events, in some cases these are exposed as simple properties of the streaming objects, in one other it's using RexEx, with a named capturing group, to find the user name in the message - inserts the data in a SQL RDBMS

      Get-EventLog -LogName "Security" | ? { $_.InstanceID -eq 4648 } | Select Index, TimeGenerated, MachineName, @{Name="AccountName"; Expression={(([regex]"Account Name:\s*(?.*)\x0d\x0a").Match($_.Message) | ? {$_.Success}).Groups['AccountName'].Value}} | % { Invoke-Sqlcmd -Query "INSERT INTO tempdb.dbo.FailedLogons VALUES ($($_.Index), '$($_.TimeGenerated)', '$($_.MachineName)', '$($_.AccountName)');" }

      I'm no genius either, have no MCSE, been into Xenix last century, but oddly enough I ended up with a completely different opinion of the people in Redmond.

      Are you joking? Based on your description, that multi-line gibberish above seems to be equivalent to
      grep -w Failed /var/log/auth.log.

    8. Re:Powershell is a Winner by Anonymous Coward · · Score: 0

      Just as a reality check, here's a single command line that:

      - gets the Windows security Event Log

      - filters for failed logon events (4648)

      - extracts some fields from the events, in some cases these are exposed as simple properties of the streaming objects, in one other it's using RexEx, with a named capturing group, to find the user name in the message

      - inserts the data in a SQL RDBMS

      Get-EventLog -LogName "Security" | ? { $_.InstanceID -eq 4648 } | Select Index, TimeGenerated, MachineName, @{Name="AccountName"; Expression={(([regex]"Account Name:\s*(?.*)\x0d\x0a").Match($_.Message) | ? {$_.Success}).Groups['AccountName'].Value}} | % { Invoke-Sqlcmd -Query "INSERT INTO tempdb.dbo.FailedLogons VALUES ($($_.Index), '$($_.TimeGenerated)', '$($_.MachineName)', '$($_.AccountName)');" }

      I'm no genius either, have no MCSE, been into Xenix last century, but oddly enough I ended up with a completely different opinion of the people in Redmond.

      Are you joking? Based on your description, that multi-line gibberish above seems to be equivalent to
        grep -w Failed /var/log/auth.log.

      Your grep example is not doing as many things as Cico71's example. Please expand your example to select specific information (Timestamp, User Login) from the lines in auth.log and insert it into a database so we can compare apples to apples.

    9. Re:Powershell is a Winner by Daniel+Phillips · · Score: 0

      So catting a file is stupidly clumsy so you are pretty much forced to create an alias to make it tolerable, but of course you will normally not have created that alias and typing in the whole command without the alias is a big pain, so chances are you simply won't carry out the task that the Unix guy would have already completed while you are still trying to find a place to store your alias permanently.

      And why does working with Microsoft products always turn out to be just like this?

      --
      Have you got your LWN subscription yet?
    10. Re:Powershell is a Winner by Cico71 · · Score: 1

      That's true: the select can be skipped and the regular expression can be directly injected in the insert command. I didn't really wanted to fiddle also with the escapes :) Also, in the above code the named capturing group was stripped away by Slashdot, but it was not really needed as we can simply use a numbered capturing group. If we also drop filtering for only successful matches, it all boils to simply the following code:

      Get-EventLog -LogName "Security" | ? { $_.InstanceID -eq 4648 } | % { Invoke-Sqlcmd -Query "INSERT INTO tempdb.dbo.FailedLogons VALUES ($($_.Index), '$($_.TimeGenerated)', '$($_.MachineName)', '$([regex]::match($_.Message, `"Account Name:\s*(.*)\x0d\x0a`").Groups[1].Value)');" }

    11. Re:Powershell is a Winner by benjymouse · · Score: 2

      So catting a file is stupidly clumsy so you are pretty much forced to create an alias to make it tolerable, but of course you will normally not have created that alias and typing in the whole command without the alias is a big pain, so chances are you simply won't carry out the task that the Unix guy would have already completed while you are still trying to find a place to store your alias permanently.

      And why does working with Microsoft products always turn out to be just like this?

      Ahem. The GP showed you how to list the *built-in* aliases. That's right, cat is a built-in alias for Get-Content. So basically you just *assume* that Microsoft products are "just like this". You fail.

      --
      Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
  68. Working on windows... by Anonymous Coward · · Score: 0

    I think I might look for another job...

  69. This is covered quite well by bertok · · Score: 5, Informative

    Essentially, for newer versions of Exchange and SharePoint, Powershell is the only scripting option, and is excellent. For older versions, you don't have a lot of options, but you can probably call COM APIs using PowerShell as well, but the effort is a lot higher. The APIs exposed by Exchange (e.g.: MAPI) are hideous. SharePoint can be managed via direct SQL database queries from anything, with some care.

    For Windows servers in general, stick to PowerShell. It's by far the best shell/scripting language by a wide margin. There's a learning curve, but it's absolutely worth it. To get set up to an equivalent level to Bash+SSH:

    - Install PS2 + WinRM2 on pre-2008 R2 servers. It's not installed by default, and 2008 comes with PS1. There's a hotfix that updates PowerShell and all associated components to v2 on XP, 2003, Vista, and 2008.
    - Enable unsigned scripts to run. Preventing .ps1 script files from running by default is a shit workaround for not having an execute bit, and is totally useless. Just turn it off.
    - Enable WinRM. This is the equivalent of SSH, but has to be enabled on both servers (which is obvious), and the clients (for no discernible reason).
    - Enable CredSSP. This improves WinRM by allowing delegated credentials to be used remotely. Unlike SSH, WinRM is an RPC protocol, and due to limitations of Windows authentication, the remote server cannot use network resources with the client's credentials (one hop security). The workaround is credentials delegation. This requires a server-side setting, and two client-side settings.
    - Install plugins. There are about a dozen that ship with Windows 2008 R2, a plugin for Exchange 2007 and 2010, and a plugin for Sharepoint. To set up the AD plugin on pre-2008 R2 domains, there's a module that has to be deployed, it's basically a web service that the PS plugin uses. The SQL plugin is an optional download that is particularly handy for SharePoint.

    That seems like a lot, but can be done in seconds from the command-line, and even better, can be done completely automatically using Group Policy. For new server deployments, I ask for my servers to be created under an AD container, and I just set those options up in a common policy configured on that container, and then everything just works.

    The equivalent of a remote SSH session in: Enter-PSSession 'computername'

    However, it gets better: You can create and store sessions in variables by creating them using New-PSSession. You can pipe objects into remote sessions and invoke commands on them, or arrays of them. In other words, a single line of code lets you invoke commands in bulk across farms of servers.

    For example, as a Citrix XenApp admin, I often have to update machine policy across a farm. This is just two lines with PowerShell:

            $xaservers = Get-XAServer | Select -ExpandProperty ServerName
            Invoke-Command -CN $xaservers { gpupdate }

    That will query the list of XenApp servers, extract the server names into an array, and invoke "gpupdate" in parallel across all of them using a temporary secure shell session.

    There might be equivalent capabilities on Linux, but nothing on the Windows platform comes close to what you can do with PowerShell.

    1. Re:This is covered quite well by dch24 · · Score: 1

      For example, as a Citrix XenApp admin, I often have to update machine policy across a farm. This is just two lines with PowerShell:

      $xaservers = Get-XAServer | Select -ExpandProperty ServerName
      Invoke-Command -CN $xaservers { gpupdate }

      That will query the list of XenApp servers, extract the server names into an array, and invoke "gpupdate" in parallel across all of them using a temporary secure shell session.

      There might be equivalent capabilities on Linux, but nothing on the Windows platform comes close to what you can do with PowerShell.

      Just for comparison, this is the same command in linux, and only very badly-built systems don't have it installed by default:
      while read server; do ssh $server 'apt-get upgrade' || break; done

    2. Re:This is covered quite well by dch24 · · Score: 2

      Of course slashdot ate the last part of that because I didn't check the preview carefully...
      while read server; do ssh $server 'apt-get upgrade' || break; done < server-list.txt

    3. Re:This is covered quite well by goonerw · · Score: 1

      - Enable unsigned scripts to run. Preventing .ps1 script files from running by default is a shit workaround for not having an execute bit, and is totally useless. Just turn it off.
      Because the execute bit is far superior to only running digitally signed approved scripts from approved signers

      SharePoint can be managed via direct SQL database queries from anything, with some care.
      Assuming you don't ever want help from PSS.

      --
      LOAD ".SIG"
      PRESS PLAY ON TAPE
    4. Re:This is covered quite well by Anonymous Coward · · Score: 0

      Nothing ready made...

      Our "enterprise" level custom administration system, includes configuration tools that are often abused by users, for doing general windows automatization, because are based on the innerfuse script interpretter, and get the job done when powershell its just to much trouble

    5. Re:This is covered quite well by x0n · · Score: 1

      While this works, it is not quite comporable because it executes serially. The powershell method has built in parallelism and throttling with the -AsJob switch.

      --

      PGP KeyId: 0x08D63965
    6. Re:This is covered quite well by rathaven · · Score: 1

      Agree with this 100% - VBScript or app creation using vb.net or c# are fall back measures for when a quick script isn't appropriate.

      If you use Powershell look at the extensions from Quest which sometimes take a slightly onerous task in the MS supplied powershell install and add some even simpler ways of doing the same things..

  70. It's hard to bash Windows (enough) by Thad+Zurich · · Score: 1, Insightful

    There are a number of responses above with varying degrees of M$-enlightenment (thalakan's being the most professional); however, it's not entirely true that Windows was designed exclusively for point-and-click administration. That's only true of the GUI shell. Windows was *designed* to be administered by *compiled* code. Preferably C++, which is the only thing that can deal directly with the shitty disaster that is the Win32 codebase without making things worse. Everything else is a shim over the Win32 nightmare, which is still the "core" of the operating system. So, everyone saying "you're just fucked" is in some sense accurate, albeit not precisely correct. The whole OS should have been refactored starting in 2003, when Microsoft pretended to be interested in security. It wasn't, so here we are.

  71. Re:Python? also WMI and .NET by Anonymous Coward · · Score: 0

    win32api provides COM interfaces to just about everything on Windows. But you will need WMI too so make sure to get Tim Golden's WMI module. And if you need to do anything with .NET, there is IronPython: same language, just different vm underneath.

    If you do use WSH (Windows Scripting Host) do not be tempted by VBScript. Too many dead ends and limitations. Use only JSCRIPT which is basically a slightly older version of Javascript. Use Javascript and WSH instead of batch files to glue things together.

  72. Re:Don't do it... by darrylo · · Score: 2

    You can also package up ruby and python scripts into standalone .exe's, that do NOT need installed ruby or python interpreters on the target system. These standalone executables are very slow to start up, though.

  73. Re:Don't do it... by oakgrove · · Score: 1, Troll
    Hahaha. You actually think ps is a substitute for bash, screen, puppet, openssh, expect, etc.? What a fucking joke. And you got a +5? I know you shills come here because Slashdot is the "happening" spot and fertile Astroturf ground but, trust me, it won't last. What do you do when this site has lost every shred of reputation and credibility because you and your ilk have turned it into a ms circle jerk cesspool? Go back to engadget?

    Posted as me. 'Cause I care.

    --
    The soylentnews experiment has been a dismal failure.
  74. Exchange tells you what to do in the name by dbIII · · Score: 1

    MS Exchange tells you what to do with it in the name - swap it for something that works. That said you are stuck with it so the way to deal with this moving target (new release announcement - something that should have been there in the first beta and we've pretended it's been there all along now works!) is to stick to where it's behaviour is bolted down to standards outside of Microsoft and you'll know a patch or upgrade won't break the part you are talking to. Sharepoint is almost as is somebody finally decided to do a decent FTP replacement but was driven to drugs halfway through - with that you'll have no choice but to chase a moving target.
    As for the language - the developers where I work have been stung by VB changing into vastly incompatible things to the point where there are still production systems running Win98 (although part of that is hardware compatibility with A/D converter cards). They moved to python to get away from needing a pile of different VB environments. That's one choice but there are plenty of other cross platform choices. If something has libraries that do most of what you want already that's probably the language to go for.
    Fanboys that have never touched MS Exchange apart from fetching mail from Outlook will probably flame me for the first line. Instead take a deep breath and google for the new feature list of each of the last few versions of MS Exchange which will give you an idea of how much was missing from the previous one. Getting a proper backup you could use for a bare metal restore or even full mailbox recovery on MS Exchange used to be impossible without shutting the entire creaking structure down for the duration of the backup. It tries to do everything so there is no single thing that is like it - but as far as SMTP goes there are probably well over a dozen better solutions.
    Once you have it you are stuck with it and have to change the way your organisation works to fit in with the way MS Exchange operates. When that has happened there is no going back without breaking a lot of things.

  75. Re:Don't do it... by Daniel+Phillips · · Score: 0, Troll

    Powershell is actually very powerful as it can extend or be extended by the .Net framework.

    Excuse me while I shudder.

    --
    Have you got your LWN subscription yet?
  76. Windows Build Automation by jfsather · · Score: 1

    Since you mention testing, I thought I should at least mention NAnt. I run a number of build servers under CruiseControl.Net that makes calls to NAnt. The NAnt scripts make calls to thing like NUnit, MSBuild, devenv and FxCop. This automates our continuous integration and release builds. There are other tools that can be thrown in like NCover. I also do automated Flex builds, but that is under Hudson. This is on Windows Server 2003 and 2008 in 32 and 64 bit versions.

    As others have mentioned, PowerShell is very helpful as a replacement for your other scripting tools. Personally, I still use Perl.

  77. Re:Don'ts (unless you use Javascript... by Anonymous Coward · · Score: 0

    It's not so bad if you make use of the Sharepoint Client Object Model that comes with SP 2010.

    Use the Javascript version (and JQuery) to do whatever you want on an SP page, and use the .NET version of the Client Object Model to write IronPython scripts that integrate it with other systems.

  78. Re:Don't do it... by Anonymous Coward · · Score: 0

    Yes. How is it not?

  79. Re:Don't do it... by imthesponge · · Score: 1, Funny

    I know right? It's much better to hook together a bunch of command-line utilities with arcane syntax that pass bytes between one another.

  80. run by Anonymous Coward · · Score: 0

    run away as far as you can, don't waste your time with that system! have you been demoted or something?

  81. Re:Don't do it... by WeatherGod · · Score: 3, Insightful

    Oddly enough, I am not convinced. What the heck does it mean that PS can extend the .Net framework, and itself be extended by .Net? Also, for a program to have "built-in support" for PS doesn't make much sense at all because PS is a shell environment. Quite honestly, your post just seems like a bunch of buzzwords. To be more convincing, I would like to see some example commands showcasing the power and flexibility of PS.

  82. Re:A millions monkeys comes to mind by justsomebody · · Score: 2
    --
    Signature Pro version 1.13.2-3 release 83.5 beta3try7 after-breakfast edition
  83. Re:Don't do it... by oakgrove · · Score: 4, Interesting

    Those cli utilities are 30 plus years old. Any sysadmin worth his salt will know them inside and out. How is the syntax any more arcane than what is spit out by ps? And, er, last I checked the ease with which completely unrelated utilities can be chained is the point!

    --
    The soylentnews experiment has been a dismal failure.
  84. Any language that can do COM Automation by b.honeydew · · Score: 1

    Most Microsoft products from the OS itself to server software to office apps expose COM Automation interfaces. COM has been the standard for extension and automation on Windows for a long time. NET is creeping up there but COM interfaces are always guaranteed to be available from Windows Explorer to IE to Excel to Exchange. Much of the time the .NET interfaces are just wrappers around COM interfaces., You can use any language that can bind to COM objects - Python for instance with the win32 modules, or PHP. Activestate also provides COM binding libs with their Perl and other scripting language distros. As for language choice, well funny enough I always found Visual Basic 6 to be the fastest and easiest way to work with COM.

    --
    Muppet Show > Monty Python
  85. Re:Don't do it... by Anonymous Coward · · Score: 0

    STFU, nobody asked for your analysis. There isn't anything wrong w/that sig.

    Friday night and no date again? Wonder why?

  86. Re:Don't do it... by IICV · · Score: 0

    And why not? Powershell is perfect for the job.

    Let me know when it's as ubiquitous as bash or csh. As far as I know, it's only pre-installed on Windows Server 2008 or greater.

  87. Re:Don't do it... by causality · · Score: 3, Insightful

    Those cli utilities are 30 plus years old. Any sysadmin worth his salt will know them inside and out. How is the syntax any more arcane than what is spit out by ps? And, er, last I checked the ease with which completely unrelated utilities can be chained is the point!

    "Arcane" is a term that is only ever used to describe a non-Microsoft OS, sort of like the way the word "upstate" is only ever used to describe a region of the state of New York.

    It is shorthand for "I don't know anything about it, therefore something is wrong with it."

    --
    It is a miracle that curiosity survives formal education. - Einstein
  88. Should not DOS? by Flipstylee · · Score: 1

    Is there a list of should and should not dos when it comes to Windows automation?"

    Am i the only one who had to look twice?
    And is the end of the world near, or did the random quote generator resume only to come up with like 5 pages of craziness?

  89. What I use as the "can script anything guy" by mrman18766 · · Score: 1

    Since I still have to support Windows XP systems, I use what will work with them. I also don't like to have to install any additional run-times. You can accomplish almost anything with a combination of Group Policy and Visual Basic scripts. I would also highly recommended AutoIt, which i find to be a very helpful tool, especially when trying to automate anything that has a GUI. Finally I would note that what you used to MAN, now just look up on MSDN. I just use google as follows: "msdn [terms]".

  90. Re:Don't do it... by Anonymous Coward · · Score: 0

    You have an anger problem. Seek help.

  91. Bringing Perl With You by srollyson · · Score: 2

    If you're comfortable with Perl, it's definitely something you can bring with you to the Windows world. You can use Strawberry Perl with or without Cygwin. If you need to deploy code, you can use PAR::Packer's pp utility to wrap your script, its included modules, and the perl interpreter into a standalone executable.

    Perl can do a ridiculous amount of stuff when you start using modules from CPAN. The Windows world is very GUI heavy, but a lot of things can be done using CPAN modules. Writing to Word docs. Controlling VMWare. Networking with just about every protocol you can think of. Creating GUI applications for others to use. There's also a nifty little module called Win32::GuiTest which will let you programmatically control GUI programs that don't provide a command line interface.

    Good luck!

  92. Re:Don't do it... by bondsbw · · Score: 0

    No, you were trying to make the point, so the burden of research is on you. Please, enlighten us.

    --
    All my liberal friends think I'm a conservative, all my conservative friends think I'm a liberal.
  93. Macro Scheduler by Ichoran · · Score: 1

    For those things where clicking is unavoidable, MJT Macro Scheduler not only allows you to automate it, but to run in client/server mode, so you can have clients that take macroing commands from a central server. This Enterprise version isn't exactly cheap, but it can be a great way to get around the most aggravating repetitive tasks for which scripting doesn't work.

  94. Re:Don't do it... by RooftopActivity · · Score: 1

    3) Profit!

  95. PyWinAuto by pem · · Score: 1
    I've seen lots of people recommend Python, which I heartily agree with.

    For normal Windows stuff (including COM/OLE/whatevertheheckitscallednow automation) you'll definitely want Mark Hammond's py2in32.

    Even so, you'll be scratching your head and reinventing a few wheels if you want to do automation of arbitrary preexisting programs.

    Last time I did any Windows automation (which was a long time ago because I stay as far away from windows as possible), I used the PyWinAuto module, which lets you interact with other programs quite handily from inside your Python script.

    1. Re:PyWinAuto by pem · · Score: 1

      s/py2in32/pywin32/

  96. Poorly planned project by PPH · · Score: 2

    Been there, been asked to to that. In my case, management had their head up their ass.

    In a s/w project, part of the platform architecture decision is: What resources do we have available to support each option? By the time the Windows/Exchange/Sharepoint decision was made, the resources available to support development and maintenance should already have been identified. So some genius picked the platform and then realized that all they had was a *NIX guy?

    You don't decide to field a football team (yes, but what kind of football, you ask) and then realize that all you have are basketball players.

    In my case, I offered to distill the requirements down to a platform independent set and build the system the way I knew how. They could go find some Windows wizards and give their implementation a try. The Windows version was never completed.

    --
    Have gnu, will travel.
    1. Re:Poorly planned project by Zubinix · · Score: 1

      Actually I think the company is been smart. They are giving a skilled Unix guy a chance to adapt his skills to Windows since it is so widely used in the company. Knowing unix scripting is cool but knowing Windows and Unix automation techniques means you can cover pretty much any situation that will ever occur.

    2. Re:Poorly planned project by PPH · · Score: 1

      They are giving a skilled Unix guy a chance to adapt his skills to Windows

      Is the companies business one of training MSCEs or building automated systems? If its the latter, then I'd say they've lost sight of their corporate direction.

      I'm amazed at how Microsoft seems to convince so many CIOs that their job is really to train people on the Microsoft platforms, beta test their latest O/S and applications suites and generally shill for Redmond's view of the world. All at their (the corporate customer's) expense.

      --
      Have gnu, will travel.
  97. Nice Theory, Not Practical... by trims · · Score: 2

    Best Practices aren't just an abstract outline of how to solve a problem, they also incorporate some level of practical detail as to how to go about solving the problem. Best Practices don't necessarily (or should) include implementation details, but they must be at least aware of how the implementation differences impact the choice of solutions and methodologies.

    In my case, I help run the development build system for Oracle's JDK and the associated OpenJDK project. We have Linux, Solaris, Windows, and Mac to deal with, across multiple CPU architectures. While the conceptual design of the system started out being simple, we've found that the quirks of each OS require a rather significantly different approach to solving the same problem on each platform. What works on Solaris doesn't work well under Windows, et al. This kind of thing is common in multi-platform environments, where the most efficient method of doing someone on one platform can be severely sub-optimal other places.

    Back to the Question: my answer is that you should likely give up on the techniques you found worked well under *nix. You want to use the Native Windows tools. Powershell and a native Python implementation work very well for basic stuff, but you'll likely want to crack open a copy of Visual Studio and actually do some .Net development for anything rather complex. I've particularly found that several common assumptions under *nix aren't true in Windows (e.g. process manipulation/management is very different), and you really need to move into the Windows mindset to get a good design and implementation going.

    --
    There are always four sides to every story: your side, their side, the truth, and what really happened.
  98. Re:Don't do it... by racermd · · Score: 5, Informative

    You bring up a good point, but I'm going to address this to the OP.

    As previously noted by the other commenter, Powershell is useful if your environment is full of Vista computers or newer or if you have more control over the environment so Powershell can be installed (there is an XP installer). It's major draw is the usefulness to systems admins that want to do real-time execution.

    Otherwise, you're looking at VBScript or batch scripts. Neither are nowhere near as elegant or smooth as some other languages, but tapping WMI and other Windows objects is actually really simple using VBScript. There are loads of examples here. Also, a Google search in the form of "vbscript %thing%" will usually get you pointed in the right direction.

    Do yourself a huge favor, though - get a decent editor. While Windows has a simple notepad app, there is no context highlighting, in-line completion, or other helpful tools for looking at script code. Personally, I prefer PrimalScript because it's useful for other things like SQL, C, Perl, etc (including PowerShell). It also has a built-in debugging engine. However, that app can be expensive. One good free alternative is Notepad++ with the appropriate plug-ins for the files you want to create/edit. There are plenty of others out there, so grab whatever you feel works best for you.

    If you're planning on using a database and are familiar with MySQL, you should feel nearly at home with Microsoft's version of SQL. There are some minor syntax differences (for example, the update query is slightly different, if my memory is correct) but it shouldn't take long to get used to them.

    Lastly, ideally, you're going to want to an account that is a local administrator on all of the systems you will be touching. Yes, you can do some serious damage with such an account and is typically not the way of things in the *nix world, but many aspects of a Windows system are inaccessible unless you have an Administrator level account - especially remote access to certain things like the registry and WMI. If getting a local administrator account on all the systems you're responsible for isn't an option, have someone that does have one (or a domain admin account) on speed-dial in case your scripts fail due to permissions errors.

    Good luck!

    --
    My sources are unreliable, but their information is fascinating. -- Ashleigh Brilliant
  99. Re:Don't do it... by clang_jangle · · Score: 1

    Obviously all women require that sort of advice from men, so we can hope to be "proper women".

    Get over yourself, indeed!

    --
    Caveat Utilitor
  100. Python & Win32 Extensions by mrtwice99 · · Score: 1

    Try it. The PyWin32 mailing list is also very helpful.

  101. Methodological approach by Anonymous Coward · · Score: 0

    > so what approach and methodology is best for developing, say, the automation required for a test system?

    Suicide?

  102. The answer is simple by Anonymous Coward · · Score: 0

    RUN

    RUN like the wind

    Get as far away as you can get.

  103. Re:Don't do it... by ToasterMonkey · · Score: 2

    Careful, SSH and haphazard interfaces do not play in Linux's favor.

    Day 1) Walk in the door, optimistic about what can be done with this "Enterprise" platform.

    You know this works exactly the same way s/Windows/Linux/ and vice-versa

    I use Puppet for doing Linux configuration management, and it is an _awesome_ tool but shows just how much Linux is lacking in basic system instrumentation, configuration management, and datacenter level administration. That is an area Windows has a leg up.

    Kerberos + formal APIs beats SSH + only standardized interfaces are 30 years old
    Think what it takes to programmatically manage crontab entries for a minute, compared to something with an API for scheduled tasks built in.
    It's not even a contest, Linux is HORRIFIC at programatic configuration, you cannot lie about this.

    If SSH is your idea of remote automation heaven, then I hate to tell you, but you can install that on Windows. There's a good chance you wouldn't need to if its kerberized WMI interface does what you need, and you can't just install "instrumentation" into Linux. And these are standard interfaces I'm talking about .. http://www.dmtf.org/

    Once you get to the datacenter level, doing things programmatically is KEY. This SSH + messy nondeterministic CLI bullcrap doesn't cut it.
    Sorry, but you home Linux admins that think Linux is the tits needs to wake up. Microsoft is reeling right now, but Linux vendors are getting complacent. As complacent as Microsoft was...

    At least document fucking return codes, and do something useful with them if you can't write out something parseable! Sun got that much right for Chirst's sake, and Linux fanbois like to pretend their are working on a UNIX system. Want an example??

    man yum, tell me how you would know if a package installed or not when I do "yum -y update foo"
    That is the bullcrap I'm talking about. OS updates... not exactly some obscure interface huh?

  104. Re:Don't do it... by homesnatch · · Score: 5, Interesting

    I'm a *nix guy, and I do have to say Powershell is pretty sweet.

    Here's an example of something extending Powershell. VMWare released a module for PowerShell that allows for control of VMWare env using Powershell.

    #Load VMWare snap-in for powershell
    LoadSnapin -PSSnapinName "VMware.VimAutomation.Core"

    #Create VM from template and then start it
    $myNewVMName = "NewVM_01"
    $myTemplate = Get-Template "TemplateName"
    $strDestinationHost = "ESX01"
    $myNewVM = New-VM -Name $myNewVMName -Template $myTemplate -VMHost (Get-VMHost $strDestinationHost)
    Start-VM $myNewVM


    VMWare created a really awesome extension to Powershell, that allows for all sorts of inheritance and piping. Microsoft created a rather poorly implemented Active Directory extension for Powershell (can't pipe or inherit on things I would expect to be able to)... MS could have used the VMWare example to make a better AD extension.

  105. Re:Don't do it... by M0j0_j0j0 · · Score: 1

    Now you made me sad :(

  106. Re:Don't do it... by Anonymous Coward · · Score: 0

    And why not? Powershell is perfect for the job.

    Let me know when it's as ubiquitous as bash or csh. As far as I know, it's only pre-installed on Windows Server 2008 or greater.

    Uh... bash/csh isn't pre-installed on any Windows. Pay attention... OP is moving to a Windows environment.

  107. Why by Anonymous Coward · · Score: 0

    Why

  108. Re:Don't do it... by parlancex · · Score: 3, Insightful

    And why not? Powershell is perfect for the job.

    Let me know when it's as ubiquitous as bash or csh. As far as I know, it's only pre-installed on Windows Server 2008 or greater.

    Okay. It's as ubiquitous as bash or csh. It ships out of the box with Windows Vista, 7, Server 2008 and 2008 R2, and for XP it is included in Windows Update so any computer properly receiving it's updates will have it.

  109. Re:Don't do it... by Anonymous Coward · · Score: 0

    Otherwise, you're looking at VBScript or batch scripts.

    Powershell handles WMI - http://technet.microsoft.com/en-us/library/dd315295.aspx

  110. Re:Don't do it... by parlancex · · Score: 2

    Uh, Powershell commandlets don't actually return text responses at all, they return .NET objects which can be represented as serialized XML. They turn into "worthless 6 line responses" when you pass those objects / XML to the default text formatting output, which is implicit when you are using Powershell shell. This is one of the reasons Powershell is great, no serialization and reparsing occurs when passing and piping data between commandlets and the object structure and it's associated methods are maintained.

  111. Ruby, Win32OLE by Jane+Q.+Public · · Score: 2

    Ruby has for years come with a wrapper library for Win32OLE.DLL, which in turn allows you to automate any program that acts as an OLE client, like IE, Excel, etc.

    As long as the program has OLE hooks, you can control whatever functions it makes available via OLE. Another tool that is often used with Ruby in the Windows environment is AutoIt!, a Windows scripting tool, which itself (I believe) operates through the OLE interface.

  112. Tips for Win Scripts by Anonymous Coward · · Score: 0

    Application called "Scheduled Tasked" (usually in Program --> Accessories --> System Tools) is equivalent to setting Cron Jobs.

    Group Policy (Active Directory and Appropriate package must be installed) can distribute and run your scripts (say for users at login).

    Backup frequently, being sure to include System States.

  113. GnuWin32 and UnxTools by spam4rakesh · · Score: 2

    I have had similar problem. I cant say its good or bad but I adpated myself to use batch programming but I heavily use Gnuwin32 ports and UnxUtils that give most of the Unix commands as exe http://gnuwin32.sourceforge.net/ http://sourceforge.net/projects/unxutils/ Happy Hacker

  114. PowerShell by Anonymous Coward · · Score: 0

    PowerShell is your friend.

  115. Re:Don't do it... by Creepy · · Score: 2

    Powershell is great, but not what I would call a great GUI test tool. Sure it can be done, but you're going to need some snapins and there are limitations. Also you may have to write to the lowest common denominator, and if that is XP that may be Powershell 1.0, and that is quite limited IMO (you could download 2.0, which is now available for XP, but it wasn't when I was using powershell). I personally had to abandon my Powershell work, which was more command line than gui because management wanted the upgrade code to be a single script for all platforms and then they added Linux support to the mix (so I kinda moved in the opposite direction of the original poster).

  116. Just use Cygwin by defaria · · Score: 1

    I don't know why you think that Cygwin cannot deal with Windows type stuff like Exchange and Sharepoint. You're a little vague as to what you need to do with them. I use Cygwin while on Windows and find it can do just about all I want to do.

  117. Re:Don't do it... by Creepy · · Score: 1

    PowerShell is great for this type of automation, but for GUI automation you need to do all scripting to do it with PowerShell (at least the last time I checked - I did find some snap-ins for GUI calls, but never anything that records them as PowerShell calls). If that is OK, great, but if you have access to the API a more modern record and playback (+ maybe a hair of customization - like for unique key names - our internally built software adds a number when using these automatically) that relies on events to the widgets rather than mouse clicks may be a better route. Our devs said the record and playback was trivial to add to .NET and Silverlight clients (we support some phone clients and HTML5 was too immature at the time - maybe after it gets ratified in a couple of years... - our other client is java based).

  118. Re:Don't do it... by MercBoy · · Score: 2

    Don't be shy. Tell us how you really feel.

  119. Re:Don't do it... by Anonymous Coward · · Score: 0

    In what way is any of that more powerful than what could have been written as just regular commands? PS is just a new locked in way of doing the same old shit. I'll pass.

  120. Re:Don't do it... by Mendy · · Score: 1

    PowerShell is nice but it's a single purpose tool. Arguably this is a good thing but as you can do the same things with Python (including working with WMI etc.) I prefer to use that instead.

  121. Powershell workflow automation by philos · · Score: 2

    There's a product called PowerWF Studio from Devfarm software that combines the best of building block "drag and drop" workflow development with an excellent Powershell editor. Definitely worth a look for this type of situation.

    FD: I don't work for the company, but I happen to be friends with the owner. I'd recommend looking at it regardless.

  122. Re:Don't do it... by jetole · · Score: 1

    I use puppet myself and it is a great !@#$ing tool but as far as your yum question, I don't know what the answer is but on debian, ubuntu or anything else that uses the dpkg system, the answer is this

    dpkg --get-selections package-name

    This will return the package name you searched for, tab separated by it's install state. i.e. deinstall, install, hold, etc. Fairly easy to program to get the status of whether or not a package is installed.

  123. Re:Don't do it... by keeboo · · Score: 1

    Interesting, reminds me of ARexx, except that PowerShell came 20 years later.

  124. Re:Don't do it... by keeboo · · Score: 1

    3) Profit!

    Indeed.
    The Linux-based servers and the legacy Tru64, AIX servers I have to maintain pay my bills. Thanks Unix!

  125. Powershell & WMI by Anonymous Coward · · Score: 1

    I'm about 2/3 Windows and 1/3 Linux sysadmin. I've done perl, bash, DOS batch, vbscript, Powershell (etc). I honestly feel much more power over my enterprise with the Windows tools than I do Linux. It's probably a combination of a couple things:

    Active Directory for single-sign-on (no authentication) admin access to all my boxes, by just opening one command prompt / Powershell window with Run-As and my admin credentials. So in one window I can do anything to any of our 1500 Windows servers in my enterprise. I don't have to mess with sending alternate credentials to each server, or accepting/caching SSH keys, or any of that.

    While archaic at times, the structured availability of all the WMI classes is SO powerful. While similar in ways to the /proc system, I find a lot more value. And you're not grepping config files, where unexpected content or typos will mess you up.

    (Oversimplified) one-liner Powershell to get the BIOS versions for all your servers? $servers just needs to be an array of computernames. Can be populated from anywhere (a database, a text file, or Active Directory query)

    gwmi win32_bios -computer $servers | select __SERVER, ReleaseDate | sort ReleaseDate ..love it.

    1. Re:Powershell & WMI by JonJ · · Score: 1

      Basically, you're an incompeten Linux-admin. That's okey.

      --
      -- Linux user #369862
  126. Re:Heres how you do it! by Anonymous Coward · · Score: 0

    Since you already knows how to do it on a *nix computer I advice you to:

    1. Buy a Slackware Linux 13.37 CD
    2. Install Slackware on your windows computer.
    3. Do as you did when doing automation on a Linux computer.
    4. Profit from your old knowledge !

    Never change whats perfect.

    You're going to be *that* guy when you're 58, still clinging to your outdated philosophies, hanging on for just another couple years before you can retire and get away from those young punks.

  127. Or AutoIt by Ken_g6 · · Score: 1

    Quick Test Pro really is a good product, but it's really expensive too. If you want a free (if not Free) alternative, look into AutoIt [autoitscript.com]. It has a SciTe editor that comes with it, which can help with setting up automation by recording. (Never use recording, on any GUI automation system, without at least looking over the script; but it gives you a nice baseline to work from.)

    --
    (T>t && O(n)--) == sqrt(666)
  128. Re:Don't do it... by DAldredge · · Score: 1

    You are just upset that he was right.

  129. JPSoftware TakeCommand (REXX PERL etc) or AutoIT by Anonymous Coward · · Score: 0

    There is a free limited version of the TakeCommand (just console, no gui, and no script interpreters) but including their very nice extentions to the bach language

    I may be out of fashion, but love to script windows in rexx, and the win32 ibm code base its now free and open source

    For frecuently needed windows specific, recurrent, and platform idiosincratic tasks, nothing beats the ease of use and flexibility of AutoIT (or AutoHotKey... both freeware)

    Using the Console2 project in sourceforge you can have a free tabbed terminal window

    Or just buy the full TakeCommand (some people here use radmin instead)

  130. Cygwin is actually the right answer by Anonymous Coward · · Score: 1

    Having done this myself (a bunch of Windows servers that were kept around because they were needed for a particular proprietary app), the right answer that works is actually Cygwin. With sshd on every box. It's the only halfway sane way.

    If you're not allowed to install Cygwin, you're working with one hand tied behind your back. Get your resume in order.

    The important thing here: Keep a local Cygwin repo, in which you copy all those downloaded files to an accessible place on your network. It is less important that the Cygwin installation be up to date than that it be consistent. You can have DLL Hell with multiple versions of cygwin.dll happening to be present on a box ...

  131. Not a lot of help so far, eh? by rickb928 · · Score: 1

    And not surprising.

    First, get into VBScript AND VBA. I think SFU 3.5 runs on Vista/7, and Powershell is just very useful. But VBA and VBS will et you do plenty.

    Trying to use Java and Javascript will frustrate in many ways, but might be helpful.

    It sounds like you are trying to develop test utilities for your development. VBS/VBA are very helpful here. You could develop an Excel sheet and use VBS to create SMTP messages and drive mail to an Exchange server pretty easily. And use it to pass messages to your various platforms, including Sharepoint if someone has been listening to Microsoft consultants again. It happens even in the best organizations, don'te be embarassed.

    I work with a creative guy that uses VBS to create messages for a test financial system. He's got it down so he can create 100,000+ messages that fire all errors and encompass all desired scenarios, with unique sample data if desired or a standard data set. These include ASCII, EBCDIC, packed binary/bcd/decimal/whatever- the-programmers-are-calling-this-week, BLOBs, hex, and encrypted strings. When the developers tried to do this themselves, it took them 4-5 manhours for one test, and they test 20-30 times a day at some points. He satisfies their demands in 5-10 minutes, submits via HTTPS PUT, and then parses the results and sends this back to them all in a half hour. They loathe him, because he demonstrates their futile efforts to solve the problem the same day they declared the problem solved, usually before they can schedule the celebratory luncheon. Fun to watch, since it's not my group involved...

    Oh, and he's porting this to a Java app so it can be given out to the development teams and deprive them of another excuse to drag out the process. There is nothing about this development process that offshoring hasn't made substantially worse by every measure. Well, maybe the celebratory luncheons are more fun...

    --
    deleting the extra space after periods so i can stay relevant, yeah.
  132. Two primary techniques by sjames · · Score: 1

    The most important part is error correction. There are two primary methods in the windows automation world.

    In the Gibbs method, you smack the low-paid butt monkey on the back of the head sharply when he does it wrong.

    In the Hill method, you give the butt monkey several quick slaps to the top of the head. This works best with older balding butt monkeys.

    For the more advanced, there's also the Blackadder method where you devise a cunning plan to avoid being forced to go catch bullets in the first place. That one can work for a while, but tends to fail in the end.

  133. Comment removed by account_deleted · · Score: 2

    Comment removed based on user account deletion

  134. Re:Don't do it... by Sprouticus · · Score: 3, Informative

    This is false. Powershell is available as an addon for Win XP and Win 2k3. The poster above said preinstalled fo a reason. Any decent Window environment should have a software distribution system which makes the update for PS 2.0 a non issue.

  135. Re:JPSoftware TakeCommand (REXX PERL etc) or AutoI by Anonymous Coward · · Score: 0

    On second tought, if you have the money:
    - the best native scripting alternative in the same range (from win95 to win7) probably will be the polar engineering vba
    - and again, in the same support range (from win95 to win7) by far the best option for custom binaries its Delphi (7 will do) or maybe powerbasic if you only care for api and com integration and dont need rad

  136. Re:Don't do it... by Anonymous Coward · · Score: 0

    yes, you were being a cunt. good job on that but we're talking powershel here, so GTFU btard.

  137. Re:Don't do it... by pspahn · · Score: 2

    I dunno. When it comes to Linux, arcane seems to mean that the syntax is not consistent or some other weird thing.

    Yes, you're right however. The term is used by people who are less experienced with Linux, and the frustration arises every couple/few months or so when a configuration change or something is needed, and the CLI tools often use different syntax or are otherwise inconsistent with the rest.

    Sure, to the Linux vets, it's all stuff that's been used and learned for awhile. But for those of us that leave a Linux box alone and rarely need to jump into any config stuff, the syntax IS arcane.

    --
    Someone flopped a steamer in the gene pool.
  138. autoit does anything simply by Anonymous Coward · · Score: 0

    Autoit, free and can compile it's scripts to exe if you want. IT can even interact with GUI only probrams unattetnded

  139. Re:Don't do it... by StuartHankins · · Score: 1

    I can do the same thing in 3 lines of code using only SSH and virsh in our KVM environment (1 line to set sh as shell, 1 to run SSH and use virsh to clone / create a VM, and 1 to start it). Perhaps a better example would be getting the current swap usage... No that's 2 lines using SSH. Maybe determining the list of software updates available on our entire network of Linux servers? 1 line to set sh as the shell, 1 line to read the list of servers from a file, 1 to start the loop, 1 to execute SSH with a yum list updates, 1 to accumulate the output, 1 to close the loop, and 1 to use mutt to email me the file. 7 lines.

    How exactly do you see Windows updates for all packages again? Oh, right, it's not a feature. Yawn. Call me when that toy becomes as powerful as the Linux/UNIX tools we've been using for decades. And doesn't require a huge set of frameworks for basic tasks.

  140. Re:Don't do it... by lucm · · Score: 1

    > What the heck does it mean that PS can extend the .Net framework, and itself be extended by .Net

    Using .Net you can create commands (CmdLets) which can then be used in Powershell scripts. It is therefore pretty easy to extend the built-in CmdLets by adding something customized for your needs. You can even dynamically create data types in Powershell using C# syntax, and then use the objects in the scripts.

    On the other hand you can invoke Powershell from a .Net software to use its powerful features. Many tools nowadays in the System Center suite are built using Powershell, and only the GUI is done in C#. Powershell is more fluid and flexible.

    Most enterprise software on Windows now comes with a .Net SDK; being able to interact with those libraries in a scripting language is very convenient.

    > To be more convincing, I would like to see some example commands showcasing the power and flexibility of PS.

    Just an example, using PowerCLI (the VMWare Powershell extension), if you want to get the list of VMs on all the hosts managed by the VC to which you are connected, you simply use this command:

    Get-Hosts | Get-VM

    and if you want the output in a nice CSV file that you can then import in a DB or open with Excel, you type this:

    Get-Hosts | Get-VM | Export-Csv -path c:\MyFile.csv

    Now with this short one-liner you can get you VM inventory; imagine what you can do with a whole script. The piping is extremely powerful, the engine will figure out if you pass a property, an object or a string. But you can also use enumerators (such as For Each) or use a Perl-like notation (such as | % {} instead of For Each).

    > Quite honestly, your post just seems like a bunch of buzzwords

    The original question was about automation on Windows; I think Powershell is a perfect tool for that kind of task so I had to disagree with the guy who said it was an abomination. When you know how to use it, it is very powerful and convenient. It feels a lot like Perl, but with some features that are specific to Windows.

    --
    lucm, indeed.
  141. Re:Don't do it... by SanityInAnarchy · · Score: 2

    only standardized interfaces are 30 years old

    The mouse is almost 50 years old. You'll have to be way more specific about what's actually wrong with the interfaces that exist, standard or otherwise.

    Think what it takes to programmatically manage crontab entries for a minute,

    99% of all tasks I want to schedule with something like Cron need to run hourly or daily. It is a one-liner to add an hourly, daily, weekly, or monthly cron job. Oh, and there's a cron.d on my system.

    It's not even a contest, Linux is HORRIFIC at programatic configuration, you cannot lie about this.

    Erm... if you say so. I mean, I can also put my entire cron configuration in version control -- hell, I can put my entire /etc under version control, and I can get meaningful diffs/patches, comments, etc. Can you say the same for Windows configuration?

    If SSH is your idea of remote automation heaven, then I hate to tell you, but you can install that on Windows.

    Yes, and you can install Kerberos on Linux. That buys you nothing. SSH sucks as a method to automate Windows, certainly, but that doesn't tell us much either.

    messy nondeterministic CLI

    I find it really bizarre that you can say that in the same breath. Nondeterministic... so other APIs are deterministic? What do you mean by that?

    man yum, tell me how you would know if a package installed or not when I do "yum -y update foo"

    Probably couldn't get it from that one command, but I could check the status before or after the fact:

    yum list installed foo

    It is true, the exit code isn't documented, but it is fairly standard that success is 0, anything else is an error. I just checked on a redhat system -- "yum list ksh" shows me that ksh is available, and returns 0. "yum list installed ksh" errors and returns 1, since ksh isn't installed -- but repeat the same with dash, which is installed, and it returns 0.

    Should that be documented? Sure, but this isn't exactly "undocumented, may change suddenly with disastrous results!" territory here. Never mind that the output is easily parseable.

    Oh, and... OS updates... Say, when can I expect an API to deliver my app via Windows Update, hmm? At least updates to it, if not the full installation?

    --
    Don't thank God, thank a doctor!
  142. Re:Don't do it... by Culture20 · · Score: 1

    "Arcane" is a term that is only ever used to describe a non-Microsoft OS

    LOL As if undocumented registry hacks and tricks like "psexec \\computer cmd /c echo . | wmic bios get serialnumber" are normal. Why does wmic still require ghostly input?

  143. Re:JPSoftware TakeCommand (REXX PERL etc) or AutoI by Anonymous Coward · · Score: 0

    I will just had the freeware servers freeSSHd and freeFTPd for a perfect scripted remote administrated windows on the cheap
    http://www.freesshd.com/

    Or for the cygwin based mobassh for a more linux feeling
    http://mobassh.mobatek.net/

  144. Re:Don't do it... by lucm · · Score: 1

    > Call me when that toy becomes as powerful as the Linux/UNIX tools we've been using for decades.

    Well don't get involved in a thread about automation on Windows if you are not interested. Showing your incredible SSH skills and your disdain for Windows is definitely impressive but it is also off-topic.

    But one thing is sure: as soon as I can get a client to have a budget so someone can send himself files with mutt I will contact you (I hope they won't pay by the line otherwise it will be a bad deal for you with your powerful 7-liners).

    --
    lucm, indeed.
  145. whoops by Anonymous Coward · · Score: 0

    As soon as you mentioned Exchange and Sharepoint, you're fucked ... the only way you could make it worse it to mention Project. Crap software written by large crowds of overpaid geeks who don't respect their company anyways. Get a grip. If you're 'next project' is M$ then don't come whining to the crowd. Suck up and handle the shit in your britches

  146. Re:Don't do it... by PaladinAlpha · · Score: 1

    I'm sorry. I'm really not trying to be obtuse; this is a serious question.

    How is any of that different from shell scripts?

  147. Re:Don't do it... by PaladinAlpha · · Score: 1

    Yeah, that's great as long as you and everyone who ever uses your output forever uses .NET, eh? Locking into a single product from a single vendor couldn't possibly create problems. Although really I guess you're locked in to running on a single platform using a single utility from a single vendor -- the SAME vendor, haha -- so it's not too much of a jump.

  148. Re:Don't do it... by Penguinisto · · Score: 1

    To be fair, Powershell isn't pre-installed, either. ;)

    Powershell is however "perfect" for the job because half of anything you do on Exchange 2007 or 2010 requires using the thing anyway, and while clumsy as hell, it is miles above using *vb* to do anything.

    --
    Quo usque tandem abutere, Nimbus, patientia nostra?
  149. hmmmm by Anonymous Coward · · Score: 0

    well, let's review. You've done automation with Unix before ... check ... So I'm guessing your not a complete moron. Now you are switching to Windows. Wow!!! I don't think any of us has done that. Another project on a different OS?!?! you didn't!! ... There's no *way* you're doing projects on one OS and then switching to another!!! Just wow!! ... oh ok, all kidding and bs aside. If you're for real, do a google search and figure it out. If you're just a fucking shill then ... ... ... just sayin

  150. Re:Don't do it... by parlancex · · Score: 1

    Yeah, XML is really proprietary, impossible to decipher without reverse engineering; the worst format for interoperability.

  151. Re:Don't do it... by blymn · · Score: 1

    Actually, if you are running exchange 2008 or later then you have to use powershell - the wmi hooks for vbscript just don't exist for later versions of exchange. You can get powershell for XP but you have to be on SP3. Powershell does have its quirks though, the one that particularly catches me is trying to reference component of an object in an argument list. Doing a GUI is an exercise in patience. If you have done some perl programming then you should be reasonably comfortable with Powershell.

  152. Perl, ReXX? by AliasMarlowe · · Score: 2

    How about Perl or ReXX instead of Powershell? What would slashdotters see as their advantages and disadvantages compared to Powershell?
    There is likely to be a reasonable selection of earlier work available in both, even for Windows.

    --
    Those who can make you believe absurdities can make you commit atrocities. - Voltaire
    1. Re:Perl, ReXX? by bertok · · Score: 3, Insightful

      When in Rome, do as the Romans do.

      He was asking about Windows server administration, and PowerShell is the right way to do that.

      For most new Microsoft server products, the script bindings are only available for PowerShell (in the form of snapins or modules). Many third-party vendors are releasing products that are PowerShell only. It is also the only shell that can call all mainstream APIs (COM, WMI, WinRM, and .NET).

      Perl specifically is one of the worst possible options for Windows scripting. It is a text processing scripting language designed for Linux, where most applications and even system APIs are text based. Windows mostly uses object-oriented binary APIs. Very few Microsoft server products have text-based command-line tools that could be automated with Perl.

      Suggesting Perl for Windows automation is a bit like trying to script Linux with VBScript. Does that sound like a good idea to you?

  153. ps output has a standard governing it... by tlambert · · Score: 1

    ...so you can write scripts that depend on the format and have them work in 2032.

    Just saying.

    -- Terry

    1. Re:ps output has a standard governing it... by oakgrove · · Score: 1

      I have 20 year old bash scripts that work perfectly. Sed, awk, find, grep, etc. don't change much. Please find a real complaint. Furthermore, you have no way of knowing that your scripts on ps will work 20 years from now. I mean, it's not like MS deprecates api's right? How do you know powershell itself will be here then? If ms drops it, you're screwed. Bash can't be dropped. It's just a ./configure make make install away.

      --
      The soylentnews experiment has been a dismal failure.
  154. What is this "Powers Hell"? by tlambert · · Score: 2

    I would like to subscribe to your newsletter.

    Try the veal.

    -- Terry

  155. IronPython by Yuioup · · Score: 1

    I highly recommend writing IronPython scripts and having them regular run using the Windows Task Scheduler. This has worked remarkably well for us.

    I got laughed at the first time I suggested it, but now my IronPython scripts are well in demand for such tasks.

    Y

  156. Re:Don't do it... by benjymouse · · Score: 2

    I'm sorry. I'm really not trying to be obtuse; this is a serious question.

    How is any of that different from shell scripts?

    One of PowerShells roles is indeed shell scripting. As shell scripting it is really powerful and robust. It has a very consistent syntax, borrows from *nix pipe paradigm (but improved upon it with object-oriented pipes), has an very advanced scripting language with structured exception handling, optionally static/dynamic typing, closures etc.

    PowerShell defines a lot of infrastructure and conventions directly aimed at shell scripting, e.g. all commands which can somehow change system state (write to files, change registry entries, delete directory entries) supports the -whatif and -confirm parameters. These allow you to run a script in simulated mode or in a mode where you are prompted to accept or reject each change. PS infrastructure makes it easy to build the same support into your own cmdlets, functions and scripts.

    Shell scripting is but one of its roles. PS has also been designed to be a automation engine to be used within applications, e.g. GUI applications. The PS commands (called cmdlets) use strongly typed parameters as opposed to weakly typed (text-only) parameters in traditional shells. Also, the PS execution model is to *not* spin up external processes when executing commands, but to process the cmdlets in-process.

    This means that cmdlets are really well positioned to become the back-end of a GUI application, essentially using the same class as an implementation of the command pattern in a GUI tool and as a PS cmdlet. You *can* do this with traditional *nix tools, but the text serialization/deserialization and separate-process model constantly get in the way, not to mention the fact that there are some objects which are not at all suited to be represented as text in the first place. PS cmdlets can manipulate in-process (in-memory) objects passed to them without serialization. This is what they do on the PS pipeline and what they'll do when PS is used as an in-process engine within a GUI application.

    --
    Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
  157. Re:Don't do it... by TheLink · · Score: 2

    Might not have much of a choice.
    **gripes**
    Here are my gripes about windows from an admin POV:
    1) Unlike unix/unixlike OSes with Windows quite often you cannot rename/move/delete files/dirs that are in use. You might be able to do it in some cases, but not others, it's quite annoying if you are trying to atomically change/upgrade/update stuff without rebooting/restarting too much crap. You may think this is a small thing, but it has a major effect/limit on how you do stuff on windows (even Microsoft has to force reboots to change files).
    So you may have to resort to stuff like this: http://technet.microsoft.com/en-us/sysinternals/bb897556

    Might not be as big an issue once you're large enough to use load balancers :).

    2) The fine grained ACLs are good, but they often don't seem to work properly. On Win2k8 I've encountered cases where an account belongs to the Administrator's group but it somehow does not have enough permissions to rewrite/save a file that "full access" permissions to those in the Administrator's group. Why can't I open the file, change it and save it back? When I use that account to copy a file onto that file I get a "privilege escalation" prompt and if I "OK" it it overwrites the file. So the account is definitely in the Administrators group already...

    3) I don't know why but lots of Windows stuff tends to have crappy logging by default. You often have unhelpful error messages that say "it hurts", but not tell you where it hurts, or what was being attempted, or what the target was. Some are even more useless! e.g. "UVD Information".

    In theory this shouldn't be OS related but somehow I've had a lot less trouble figuring out what's going on from logs in linux/*bsd machines than from windows machines -e.g. it's faster/easier to figure out why email is not being received/sent with the former than the latter.

    Searching for stuff in windows event logs is also a pain and a lot slower than using tail and grep on the unix/linux text logs.

    4) Too often nobody seems to know what things actually do or how things actually work, not even people working for Microsoft - (e.g. this is not the full story: http://blogs.msdn.com/b/oldnewthing/archive/2007/10/08/5351207.aspx
    Apparently there's stuff like a not very documented ITaskList_Deleted property which also affects how windows are handled...
    Then there's the ServerXMLHTTP vs XMLHTTP - my colleague found out the hard way that there are cases where ServerXMLHTTP works and XMLHTTP doesn't - he still doesn't know why. I've not seen documentation on the real technical differences - this is light on the details: http://support.microsoft.com/kb/290761 ).

    As a result there are messageboards, blogs and docs filled with incorrect information.

    And there's often no practical way to find out (unless you're an uberhacker who can disassemble megabytes of code in your sleep). With OSS stuff, at least you can look at the source and have a better idea (but sometimes you just go wow it's amazing that stuff even works, maybe I should use something else ;) ).

    **tips**
    OK end of grumbling, here's what I use for when the automation breaks down ;).

    1) Add notepad, texteditor and hexeditor shortcuts to your SendTo folder. If you are unclear on where your SendTo folder is (because of roaming profiles or other weirdness), go to start, and run shell:sendto

    Once you've done that you can right click on any file and open it with your editor/program of choice (add media player classic or VLC if you want ;) ).

    2) create a folder for utilities. e.g. c:\util or c:\bin and add it to your path (WinXP: winkey+pause, advanced, environment variables, system variables, path. Win2K8:start,right click computer, manage, advanced or something

    --
  158. Re:Don't do it... by EvanED · · Score: 1

    [Disclaimer: I have only a little experience with Powershell, and certainly don't use it on anything like on a regular basis.]

    It's not different in the sense that they are little programs that you write and primarily interact with from the shell. Where the big difference comes into play is that when you pipe one cmdlet to another, what gets piped is objects, not text.

    This has a number of useful benefits. First, they are strongly-typed. Second, no parsing is needed on the receiving end -- and this means fewer possibilities for introducing bugs. (E.g. how many times do you see people actually use 'find ... -print0 | xargs -0' instead of just 'find ... | xargs'?) Third, the scripts have access to .Net natively, which will give you way more than any shell script (though not more than, say, Perl).

    I think a fourth benefit is most intriguing, though this is mostly speculation on my part. Lets say you have a shell pipeline 'foo | bar'. There are many times under the Unix way that the way you invoke 'foo' depends on what you want to follow it in the pipeline, but under Powershell it needn't. Why not? Take ls for example. Suppose that you wanted to list the files in the current directory, sorted by size (and say for the moment that ls couldn't do this by itself, so you want to send it to some 'sort'). Under the Unix way, you'd have to do something like 'ls -l | sort ...'. Note that you had to pass -l to ls. In the Powershell world, the ls equivalent I think just spits out a sequence of objects that represent files in the current directory. If you just type 'ls', by default it would just print the file name. But those other fields are still there for things later in the pipeline to access if they need to. So with my hypothetical example, you can eliminate the -l argument.

  159. Re:Don't do it... by Anonymous Coward · · Score: 0

    Bitter, overmuch? The problem could never be you of course...

  160. Re:Windows Automation by Anonymous Coward · · Score: 0

    Sorry, but bzzzzzt! The ninth circle of hell was the frozen lake, where traitors go. A three headed Satan frozen to his waist in ice, eternally gnawing on Brutus, Cassius, and Judas. Read an annotated version concurrently with a rhymed version of the Divine Comedy, or the original in Italian. It had a rhyme structure that's next to unrenderable in English.

  161. Re:Don't do it... by TheReaperD · · Score: 2

    No, it really wasn't. I was just trying to avoid being called a troll by Windows lovers. I have been doing Windows Server admin now for 3 years. Linux, it may take some effort to get everything to work the first time, especially if you don't mess with automation a lot but, once you get it to work, it always works. With Windows, it's always about success rates. Even under ideal conditions, you can't get above 97% successful on large user base. Then you have to manually fix the 3%+ that failed. You spend a lot of time using remote desktop. I don't care if it is hard to set up if it'll run the same way every time. The WMI interface that many people have repeatedly brought up fails a lot more than they would like to admit. The only thing that can be relied upon to run 100% of the time is the cmd shell which is very limited. KIX helps a lot but, even it doesn't return 100% and you have to write more debug code than code if you want to find out who failed and why (assuming it was able to launch). Even piling on using Altiris, BixFix and AutoIT, at a ridiculous cost, can't seem to crack that 97% rate but, it'll keep you closer to it. If it was the same machines failing all the time, we'd just replace them but, it's always random and that's the fucking problem.

    I'm still floored that I got first post. I wasn't expecting that...

    --
    "Be particularly skeptical when presented with evidence confirming what you already believe." -
  162. Re:Don't do it... by JWSmythe · · Score: 2

    Actually, I was referring to this text.

    PS C:\Users\User> foo
    The term 'foo' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:4
    + foo <<<<
            + CategoryInfo : ObjectNotFound: (foo:String) [], CommandNotFoundException
            + FullyQualifiedErrorId : CommandNotFoundException

        More often than not, when I've done something wrong slightly wrong, I don't get anything useful back. Someone mentioned "Perl for Windows" comes with Windows now. Bah.

    PS C:\Users\User> perl
    The term 'perl' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelli
    ng of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:5
    + perl <<<<
            + CategoryInfo : ObjectNotFound: (perl:String) [], CommandNotFoundException
            + FullyQualifiedErrorId : CommandNotFoundException

        I know, I know, install ActivePerl. But installing a 3rd party package does *not* mean that it comes with it. I was trying to use Windows Services for Unix (SFU). I was trying to do a comparison on SMB to CIFS to NFS for access speed tests. It was a Linux server, with Win2k3AS and Win2k8 Server VM's. If you ever want to give yourself a massive headache, try this. I also connected to the same services with a stand-alone Linux (Slackware64) machine. The standalone machine had no problems. Trying to get SFU (which I read as Shut the Fuck Up) was a painful exercise in how not to get anything done for two days. As I recall, I did finally get it installed. I'm pretty sure it was the Win2k3AS server that required a download from Microsoft, and their one and only link for downloading the 150MB (if I recall right) file was broken, so I finally got it from a 3rd party who happened to have a copy.

        Oh, and setting up the Linux client? About 10 minutes, and that was because I was interrupted a few times. Come on, setting a service to run (chmod 755 /etc/rc.d/rc.nfsd), a few lines in fstab, and it's done. Samba or CIFS? chmod 755 /etc/rc.d/rc.samba, a few lines in fstab, and it's done.

        Right now, I'm looking at the lovely possibliity of changing the file shares on every machine on the network. Everyone has a dozen or so shares mounted, and they're all different drive letters. The easy way to find out? I scanned them all in Cygwin.

    --
    Serious? Seriousness is well above my pay grade.
  163. Re:Don't do it... by Dogers · · Score: 1

    2) The fine grained ACLs are good, but they often don't seem to work properly. On Win2k8 I've encountered cases where an account belongs to the Administrator's group but it somehow does not have enough permissions to rewrite/save a file that "full access" permissions to those in the Administrator's group. Why can't I open the file, change it and save it back? When I use that account to copy a file onto that file I get a "privilege escalation" prompt and if I "OK" it it overwrites the file. So the account is definitely in the Administrators group already...

    It's UAC. If you're in the Administrators or Domain Admins group and have UAC turned on, you're not *really* in that group. If you start your editor by right clicking it and choose Run as Admin (receiving the UAC prompt), the editor is now running with Admin/Domain Admin credentials, so you can edit that file as you see fit.

    Just double clicking the file opens it as a normal user, without either of those groups, which is why you can't save over the top of it. If this really annoys you, change the permissions so another group you're a member of has rights to it.

    1) Add notepad, texteditor and hexeditor shortcuts to your SendTo folder. If you are unclear on where your SendTo folder is (because of roaming profiles or other weirdness), go to start, and run shell:sendto

    I would add WinMerge to that as well - that's been useful a few times when exporting registry settings and the like.

    4) notepad++ is often better than notepad :).

    NotePad++ is ALWAYS better than Notepad! :)

    --
    I am a viral sig. Please copy me and help me spread. Thank you.
  164. Re:cmd.exe still useful by Anonymous Coward · · Score: 0

    cmd.exe has the most horrifying syntax and evaluation model imaginable. if you need anything more than a few lines of code, ditch it

  165. Re:Don't do it... by SharpFang · · Score: 0

    Oh, it's not all that bad at all.

    Day 3. Sneak into the office. Check if nobody's looking. Lock the door, disable the cameras. Install Cygwin on all machines, laughing maniacally.

    Day 4. Come to work whistling cheerfully and do all the overdue work in 2 hours. Spend the rest of the time playing Nethack.

    --
    45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B2
  166. Re:Don't do it... by Anne+Thwacks · · Score: 1
    Why does wmic still require ghostly input?

    Why do zombies need brains?

    --
    Sent from my ASR33 using ASCII
  167. Re:Don't do it... by Anonymous Coward · · Score: 0

    WSH, not WMI... that's what I get for writing this at 1:30 in the morning. --TheReaperD

  168. Re:Don't do it... by Anonymous Coward · · Score: 0

    To be fair, Powershell isn't pre-installed, either. ;)

    It is on Windows Server 2008 R2 and Windows 7

  169. Re:Don't do it... by benjymouse · · Score: 3, Informative

    I can do the same thing in 3 lines of code using only SSH and virsh in our KVM environment (1 line to set sh as shell, 1 to run SSH and use virsh to clone / create a VM, and 1 to start it).

    And I can do that with 1 line of PowerShell code (PowerShell has a consistent way to short parameters, use positional parameters and pipe full objects like virtual machines):

    new-vm ESX01 -name NewVM_01 -templ TemplateName | start-vm

    Your point? The OP was asking what to use to set up and administer test systems in a *Windows* environment. PowerShell is a valid option for that.

    --
    Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
  170. Re:Don't do it... by Cico71 · · Score: 1

    Do yourself a huge favor, though - get a decent editor. While Windows has a simple notepad app, there is no context highlighting, in-line completion, or other helpful tools for looking at script code.

    Adding another one to the list which is free, has command completion and debugging: PowerGui Editor for Quest http://www.powergui.org/

  171. Re:Don't do it... by bertok · · Score: 4, Interesting

    I'm a programmer-slash-sysadmin, and I've taken a stab at writing both command-line tools using C/C++, .NET, and these days with PowerShell, so I might be able to answer your question.

    When I write complex software, I usually provide some command-line tools for the admins to do things like import data, export logs, or whatever. This is a royal pain in the ass, but I do it because it's useful. I always end up spending something like 80% of the time on annoying stuff like handling command-line parameters, input validation, and error messages. Of course, because whatever I come up with is new and different, I have to write doco for it, train staff, and so on.

    Now, with PowerShell, instead of having to write a whole new program to implement a command, I can simply extend a class from a framework library. The PS framework does almost everything automagically: handle the pipeline, input parameters, parameter validation, parameter sets, optional parameters, help, tab-complete, wildcard matching, output formatting, etc...

    To give you an idea, it is possible to write a PowerShell command in C# (.NET) with several parameters and complex output that does a useful task in about 50 lines of rather trivial code. The equivalent C program would be thousands of lines.

    More importantly, the resulting PowerShell command will be orthogonal, consistent, discoverable, and embeddable

    By orthogonal, I mean things like: every PS command that handles wildcards does it with the same shared library, which is trivial to use. Hence, I can do things like: Get-VM "prod_win_[a-k]*" which is a VMware snapin, and the behavior will be exactly the same as if I had called a Citrix XenApp snapin to lists farm servers with: Get-XAServer "prod_win_[a-k]*". Similarly, the output of commands is structured data. You can say: Get-VM | Export-CSV or Get-XAServer | Export-Csv and get similar results. Compare with legacy command line tools, which often implement such formatting internally, and badly. I just had to work on some Novell systems, for example, which export invalid XML files because the utility doesn't escape ampersands! Of course, our example 50 line command will get all of that. Export to CSV? You have it! Export to XML? Done! Quickly, tell me how to export CSV formatted data from the following 3 Linux command-line tools: 'ls', 'apt-get', and 'ps'.

    By consistent, I mean that parameters are always specified with "-param", never "/param", or "--param", or "-abcdgh" where each letter does something that you can only determine by reading a five page document. Similarly, Microsoft has established a strict naming system for developers, so that instead of "retrieve-foo", "ask-foo", "query-foo", "request-foo", "list-foo", "foo-list", "fooenum", or god knows what else, the only acceptable standard is "get-foo". VMware has "Get-VM", Citrix has "Get-XAServer", Microsoft has "Get-Process", etc... no guessing! There are standards for command names, parameter names, and coding conventions. E.g.: Verb Naming Rules, and Cmdlet Development Guidelines.

    By discoverable, I mean that if I write a little 50-line utility with a bunch of parameters, an administrator at the command line can simply press 'tab' and have both the command and the parameter names automatically completed. The help is automatically generated from my 50 lines of code. GUI script wizards can load a bunch of metadata about each parameter to enable drag & drop script development.

    By embeddable, I mean that even a 50-line utility can be called not just from the shell, but from within a hosting application in the same process. Instead of having to handle text-based streams, PS commands take .NET objects, and return .NET objects. There's no guessw

  172. Re:Don't do it... by Krneki · · Score: 1

    Why not keep to Perl, ok you need to compile it and the script will be as big as 500k, not as clean as a native supported scripting language, but still very effective.

    --
    Love many, trust a few, do harm to none.
  173. Re:Don't do it... by benjymouse · · Score: 4, Informative

    How exactly do you see Windows updates for all packages again? Oh, right, it's not a feature. Yawn.

    Ignorance can be cured by Google (or bing). It took me 30 seconds to find out that Windows Update does indeed have a COM API which can be readily used from PowerShell. Here a way to list *all* available packages from Microsoft Update:


    PS C:\Windows\system32> $mus = new-object -com "Microsoft.Update.Session"
    PS C:\Windows\system32> $updates = $mus.CreateUpdateSearcher().Search("") | select -exp updates
    PS C:\Windows\system32> $updates|select title

    Title
    -----
    Latvian Language Pack - Windows 7 Service Pack 1 (KB2483139)
    Slovenian Language Pack - Windows 7 Service Pack 1 (KB2483139)
    ( other language packs )
    Definition Update for Microsoft Security Essentials - KB2310138 (Definition 1.103.1197.0)

    Note how the list was produced by selecting just the title. The updates returned by the update searcher are actually objects which not only expose a lot of extra information such as disk/cpu/memory capacity recommendations, severity indicators from the security response team, knowledge base article references, license text etc, but also allows you to directly proceed to install by piping them.

    --
    Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
  174. opsi for managing win clients from linux by Anonymous Coward · · Score: 0

    See: http://www.opsi.org/ (opsi is an open source Client Management System for Windows clients and is based on Linux servers.)

  175. One word: Python by Anonymous Coward · · Score: 0

    If there's any language you should learn for automation on windows, it's Python. I've worked as a build engineer in several companies and python has always been my rock in the windows environment. My background was awk and bash scripting but once I got a taste of Python, I never looked back.

  176. Re:Don't do it... by Anonymous Coward · · Score: 0

    This will return the package name you searched for, tab separated by it's install state. i.e. deinstall, install, hold, etc.

    It'll only return what you described, if the package has been installed at some point in time and haven't been purged.

    If the package in question haven't been install before or have been purged, you'll get "No packages found matching $PACKAGE" on stderr.

  177. Winbatch by gsslay · · Score: 1

    What automation tool is best for you depends, of course, a lot on what you need to do.

    I've used Winbatch for years now. For basic stuff it is straightforward and easy to learn. But it still has the capabilities of performing sophisticated and complicated automated work.

    With the right licence you can deploy compiled scripts to as many computers you like. I have dozens of scripts I use in this manner every day.

    1. Re:Winbatch by I.S.Bear · · Score: 1

      Winbatch is a good all-around tool. It can do u/sql, active directory, mail auto response and many other tricks. We use it to support a CRM and the primary inventory/payroll packages and it saves us almost 2000 man-hours a year and may break that point this year.

  178. from a company making production lines etc by Anonymous Coward · · Score: 0

    we make production lines and production line modules of all sort and we have pretty much everything run on windows, i have mostly patched up all my testing systems based on NI softwares, teststand + nidaq + NI488.2 + some .net code and you can get your system up and running in no time and trouble. getting tens of devices working together, controlling IO-s and measurement equipment over serial, GPIB, ethernet, USB or whatever is easy with these tools. NI Teststand is specialy crafted for testing systems and its great at it. in telecom devices testing its pretty much industry standard. some early attempts i made based on labview, very easy to make but result is not very good and maintainability is horrorshow

  179. Bring your CV up to date by Anonymous Coward · · Score: 0

    and start preparing for interviews. That is the only option that will let you keep your sanity.

  180. Re:Heres how you do it! by BotnetZombie · · Score: 1

    If you'd have bothered to read what you are replying to, you'd have seen that the poster specifically mentions having to work against Sharepoint and Exchange.

  181. Python by Anonymous Coward · · Score: 0

    I am just now using Python for an automation project.

    It's a great glue to hold things together. With built in modules and pyserial, you've got IO covered. With pygame, you've got joystick and graphics support. Numpy handles your matrix inversions and vector calculus. Glade and Pygtk lets you create nifty GUIs. And Matplotlib handles the outputs.

    Great plus: if you still decide to migrate to *nix, you won't have to rewrite a thing.
    Best, Jonathan

  182. Re:Don't do it... by Conley+Index · · Score: 1

    Powershell is perfect for the job.

    Let me know when it's as ubiquitous as bash or csh.

    bash is not preinstalled on many *nix systems. /bin/sh is ubiquitous and please, do not assume that it is bash. Fortunately, some Linux distributions undo that mistake. As for csh, it is widely regarded as being inadequate for scripting.

    Powershell is about is ubiquitous as bash: It is present on most of the more widespread systems.

  183. Re:Don't do it... by h4rr4r · · Score: 0

    but improved upon it with object-oriented pipes
    Made more complicated does mean improved.

  184. CMD plus Powershell or Jscript/COM/WMI by Anonymous Coward · · Score: 0

    I've been happy with a combination of CMD plus Jscript/COM/WMI integration but avoid VBscript due to the lack of robust error checking whereas Jscript has try/catch(ex) and is a more robust and familiar language. There aren't as many examples in Jscript but you can always convert from VBscript.

    Powershell is a little like Perl and is the new standard where it can be found.

    Search technet and msdn for things from The Scripting Guy and that should lead you to most of the useful references.

    I also found MSI, via WiX, a useful way to distribute changes and you can build an MSI installer that doesn't actually install, I.e. It doesn't register software but it can run Jscript and deliver binary files.

    Using Jscript in HTA is a great way to make web-gui-based admin tools.

  185. off topic by s4ltyd0g · · Score: 1

    WTF is wrong with the Slashdot UI? Comment threads are impossible to follow. Click to expand a comment and the screen jumps around to anywhere but the thread you are trying to follow. It's been doing this for what seems like a few weeks now and it has become tiresome in the extreme.

  186. Re:Don't do it... by oakgrove · · Score: 1

    Why? Because you all keep saying it? It doesn't really work that way. Furthermore, ps, no matter its merits is only one tool. There are many others you will need to imitate to match Linux.

    --
    The soylentnews experiment has been a dismal failure.
  187. Re:Don't do it... by Anonymous Coward · · Score: 0
    Agreed, while the framework for ps wants to be all this, the design of .NET has limited powershell quite a bit out of what we consider obvious in terms of management. And that was the perfect example.

    When the .NET framework has incorporated all of what has built over the last 15 years in system management on MS systems (msi, [really, msi!] all the ntinternals tools, everything that visual test can do, tcpdumpsomething, remote control of different OS's, using more internet protocols) out of the box then it will be hard for it to jump out of the "I use it because this software needs it" to "I use it to launch all other tasks".

  188. You're using a screwdriver as a hammer by jsprenkle · · Score: 1

    Windows wasn't designed for automation/server tasks. I predict lots of pain in your future.

    --
    - I've got bad karma because I won't parrot everyone else's opinion
  189. Re:Don't do it... by darkpixel2k · · Score: 1

    #Load VMWare snap-in for powershell
    LoadSnapin -PSSnapinName "VMware.VimAutomation.Core"

    That showcases everything I hate about powershell right there.

    If it were linux, the command would be somethign like ". /etc/bash_completion.d/vmware"

    What the hell is with PowerShell and switches to commands? It's like someone said "How can we possibly give users RSI by using our new interface? I've got it!! Type 700% more than they do in Linux!"

    --
    There's no place like ::1 (I've completed my transition to IPv6)
  190. Microsoft programmer help by Anonymous Coward · · Score: 0

    I wish Microsoft employees would stop posting questions on how to do their job on /.

  191. Re:Don't do it... by StuartHankins · · Score: 0

    The point was the grandstanding, the comment "I do have to say Powershell is pretty sweet" implied something interesting or insightful was going on. Half of the people in this thread make it sound like this is such a big deal, and it's still a pile of steaming crap. It's like I've stumbled into some bizarro-world edition of Slashdot where getting a limited command shell to function under Windows is some sort of nirvana. You still have a (very very very) limited shell with little of the functionality of shells created 20+ years ago. It's not exciting at all unless you haven't used any proper tools before.

    Or, to put it simply, "there is nothing to see here". What you think of as the Rapture is a meh moment at best.

  192. Re:Don't do it... by darkpixel2k · · Score: 2

    Linux is HORRIFIC at programatic configuration, you cannot lie about this.

    How am I able to deploy Linux mail servers / spam filters to our customers in under 45 minutes using a ton of automation, yet it still takes me days to get their Exchange servers online? I spend most of the time installing updates and hunting for cryptic powershell commands just so I can increase the 10 MB e-mail limit in the 7 different places Microsoft imposes that limit.

    I'm not saying it can't be automated, it's just a major pain in the ass--oh, and the 'reference' or 'test' box you are going to use to setup your initial automation will cost you thousands in licensing costs.

    If SSH is your idea of remote automation heaven, then I hate to tell you, but you can install that on Windows.

    Installing SSH on Windows is nearly useless because their CLI is nearly useless. Who wants to access such a limited interface?

    programmatically is KEY. This SSH + messy nondeterministic CLI bullcrap doesn't cut it.

    Really? How's Amazon doing it? Are they running Windows Servers to provide their cloud services?
    How about Google? I seem to remember them mentioning something about Windows being too cumbersome to support their operations.
    Remember Hotmail before Microsoft bought it? All running BSD. Then do you remember the hilarity when Microsoft bought it, there was a ton of downtime, and their engineers accidentally leaked the document saying that it would be prohibitively expensive (millions) for a company to built a service like hotmail with Microsoft's overpriced software?

    Sorry, but you home Linux admins that think Linux is the tits needs to wake up.

    I did--now I 'admin' linux servers commercially.
    The other guy on my team was just required to switch from managing a stratus running Linux to an entirely Windows environment. He used to have evenings and weekends free, now his pager is going off constantly due to bluescreens, crashes, failed updates, hangs, etc... He turned in his notice after 10 years because of the abomination of managing Windows in an industrial environment.

    At least document fucking return codes, and do something useful with them if you can't write out something parseable!

    0 = good
    Anything else = bad
    That wasn't so hard, was it? ;)

    Sun got that much right for Chirst's sake, and Linux fanbois like to pretend their are working on a UNIX system. Want an example??

    man yum, tell me how you would know if a package installed or not when I do "yum -y update foo"

    I can't answer that one. I don't mess with RedHat and it's ilk. That is the bullcrap I'm talking about. OS updates... not exactly some obscure interface huh?

    --
    There's no place like ::1 (I've completed my transition to IPv6)
  193. Re:Don't do it... by benjymouse · · Score: 3

    And maybe you want to hone up on your writing skills? You wrote

    How exactly do you see Windows updates for all packages again?

    You wrote Windows with a capital W. If you meant to hit on the fact that there's no central repository for 3rd party packages you should have left out the Windows part, like

    How exactly do you see updates for all packages again?

    See? not too difficult.

    Anyway, having a central repository has very little to do with automating a test system. For automating setting up a test system having the packages available will do just nicely. Pathetic that you must move the goalposts to keep the illusion that Windows is no good.

    --
    Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
  194. Perl and Powershell by Anonymous Coward · · Score: 0

    If you know Perl, use it. There are lots of Win32 modules to help manage Windows. Additionally, you can compile using perl2exe and run your script on boxes that don't have Perl installed. Otherwise, learn Powershell.The specialized functions for managing Windows can't be beat for quick script creation.

  195. Re:Don't do it... by benjymouse · · Score: 1

    #Load VMWare snap-in for powershell

    LoadSnapin -PSSnapinName "VMware.VimAutomation.Core"

    That showcases everything I hate about powershell right there.

    That is a lot of hate for something you obviously do not know a lot about.

    GP was mistaken. The command is actually Add-PSSnapin and the specific command could be written as

    Add-PSSnapin VMware.VimAutomation.Core

    Note how no parameter names or quotes were necessary (but still allowed).

    If it were linux, the command would be somethign like ". /etc/bash_completion.d/vmware"

    No, that would merely set up completion. A PowerShell snapin is actually a module which can have private namespaces to avoid collision in a global namespace, it can define new drives and providers etc. It is much more than completion. In fact, completion has nothing to do with it, completion will work even for script files which define parameters without any completion registration.

    What the hell is with PowerShell and switches to commands? It's like someone said "How can we possibly give users RSI by using our new interface? I've got it!! Type 700% more than they do in Linux!"

    PowerShell is just being extremely consistent, something Unix could learn a lot from! And PowerShell usually takes fewer keystrokes.

    Don't be fooled when someone shows you a command and spells out all of the parameter names in full. That is usually just because they tab-completed them. PowerShell supports both consistent shortening of parameter names, parameter aliases as well as positional parameters. All of these in a very consistent and predictable way. This even goes for your own scripts and functions. PowerShell automatically infers parameter names from the command definition - i.e. there is no need to register external completion. You need to do the latter in traditional shells because the commands lacks parameter metadata.

    --
    Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
  196. Re:Don't do it... by gnud · · Score: 1

    You can call the powershell modules from any .NET-language, as long as the windows automation libraries are installed - and Exchange needs those anyway.

    So no, you don't _need_ to use powershell. But you might as well.

  197. PowerShell Automation with COM+ Object Access by Anonymous Coward · · Score: 0

    Utilities
    Pay attention to the suggestions above from folks that already recommended good utility suites such as SysInternals, NirSoft, AutoIt!, etc. since they pretty much covered most of them.

    Look into GnuWin32 for native Linux utilities such as sed, awk, grep, coreutils, textutils, and all the other utilities that you'd find on a Linux system for your windows servers. The only disadvantage is that you have to include two of the large multi-language libs that all exe from GnuWin32 depend on. (Use Depends to find out which ones.)

    PowerShell
    I would recommended this now as a better language with more modern features over Command Prompt (Batch) and you can leverage it to execute all the other utilities and commands within and capture then process their stdin/err output simply. As the parent poster already mentioned that from within PS you can access a lot of the API's directly for automating windows such as Windows Management Interface (WMI) to query a lot of info but do very little, .NET Framework (New-Object -TypeName System.Namespace... or directly with [System.Namespace...]), COM+ Automation Objects with (New-Object -ComObject ProdID), or execute utilities directly using their names or command prompt commands using cmd.exe /c.

    Within PowerShell you have Invoke-Command and Enter-PSSession to simulate command line access similar to SSH as long as the remote server has WinRM (Windows Remote Management) interface installed and configured. You also have Job control and create by using commands with the -AsJob parameter or Start-Job commands. Some of the syntax in PS is borrowed from Bash and the pipeline ideaology of using output from one command and passing it to another as input is highly leveraged in PS and improved upon since it is object oriented allowing you to manipulate and filter out individual properties within those objects when they get passed down the pipeline giving you easier manipulation power over text and objects than you had with piping to sed, awk, or grep in your own scripts. (I still do quite a log of Batch scripting and piping to sed, grep, awk that I have on my system from the GnuWin32 utilities that I've installed that I find better and simpler to use directly than Cygwin.)

    Many of the newer Microsoft and major applications include direct PowerShell modules to allow control of them and I've successfully used these modules for VMware, Citrix, SQL, Exchange, Sharepoint.

    COM+ Automation

    Other times I've directly accessed COM+ Automation object interfaces that are available from other software exe and dll libraries by discovering their ProgIDs with OLEView COM Automation listing or by directly interrogating the exe and dll files using Visual Studio Object Browser. Once you find the ProgID then you can look at the methods, properties, events, and other members that are exposed from within those objects and determine if you can instantiate or access instances of those objects to connect to these applications and control them using those object members. I've been able to discover a few applications that have these interfaces that are not very well publicised or documented by the vendors and use those to programmatically automate some third-party applications. PowerShell makes that easy as long as you don't have to retrieve or pass complex binary structures, otherwise you'd have to go to full C, C++, or C#.

    64-to-32-bit

    One thing about PowerShell is that you now have to be aware of 64-to-32-bit issues with Windows and the Windows/SysWow64 (32-bit windows apps and libraries on a 64-bit system) and Wow6432Node (32-bit Registry mapped on a 64-bit system).

    There is also a bit of a caveat to be aware of when interfacing with COM+ objects across the 64-to-32-bit barrier on the same system since the 32-bit COM+ objects registered on a 64-bit system are only accessible from with a 32-bit instance of PowerShell x86 and remotely these 32-bit COM+ objects are only accessible in a 32

  198. Re:Don't do it... by benjymouse · · Score: 4, Insightful

    The point was the grandstanding, the comment "I do have to say Powershell is pretty sweet" implied something interesting or insightful was going on.

    There is. PowerShell is a refreshing new take on shell scripting. Granted, it is best fit for Windows because Windows is already pretty much object oriented from a system point of view. But at the same time traditional shells would struggle with incorporating OO concepts. PowerShell does away with the need for sed and awk, has a built-in extremely powerful regex engine and has modern constructs like structured exceptions, script blocks, closures, integrated help (no not just man pages) and a lot of other interesting stuff like the common -whatif and -confirm parameters, remote sessions and remote jobs, fan-out remoting etc.

    You may not like the fact that Windows now sports a shell which surpasses bash, ksh and zsh in many ways, but that doesn't mean that it is not interesting. It is for a good many of us.

    Half of the people in this thread make it sound like this is such a big deal, and it's still a pile of steaming crap.

    Yeah, whatever. You are entitled to your opinion. But please educate yourself on the subject.

    It's like I've stumbled into some bizarro-world edition of Slashdot where getting a limited command shell to function under Windows is some sort of nirvana. You still have a (very very very) limited shell with little of the functionality of shells created 20+ years ago.

    Translation: "Help, someone in here has something good to say about Windows and nobody helps me with bashing them. Anything coming from Windows cannot possibly bring anything new. I refuse to look at it. If it is any good, it must have existed for 20+ years in Unix".

    Grow up, please. PowerShell is a full-featured command shell and surpasses bash, ksh and zsh in several areas. You may still prefer *sh shells, but on Windows there is an interesting new take on the concept.

    Or, to put it simply, "there is nothing to see here". What you think of as the Rapture is a meh moment at best.

    Translation: "I don't want to hear about anything which could challenge what I already know as the truth."

    --
    Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
  199. Re:Don't do it... by RobertM1968 · · Score: 1

    LoL, I think you just proved my point. Historically, and present, virtually every other platform has had better mechanisms to deal with such things. Windows, with a lot of cobbled together technologies, still is not quite there. So, figured I'd simply help you avoid the troll mod by pointing out the lack of sarcasm that should have been in your post.

    After all, "works most of the time" isnt "works all the time" and generally is not acceptable for such things. Thus, I thought your response was actually the perfect solution - "just dont do it" ;-)

  200. Re:Don't do it... by Thing+1 · · Score: 1

    Powershell is great, but not what I would call a great GUI test tool.

    For that, use AutoIt.

    --
    I feel fantastic, and I'm still alive.
  201. Run away!! by Anonymous Coward · · Score: 0

    Believe me, coming from a Unix background you will go bat shit insane trying to figure out how to do the simplest of tasks on Windows. I have 8 years of Windows development experience and seriously contemplate leaving my job whenever I have maintain Windows code.

  202. Re:A millions monkeys comes to mind by Thing+1 · · Score: 1

    Um, "automatition?" (Bart has a breast fetish?)

    --
    I feel fantastic, and I'm still alive.
  203. python is an elegant crossplatform solution by Anonymous Coward · · Score: 0

    In my experience, python is a wonderful solution for these sorts of problems. With it's windows modules you can script using COM, manipulate the registry, access local and remote databases easily. Using the ssh protocol you can use standard deployment tools like fabric. Finally, you are using python so your scripts are likely to be easy to read and maintain. I create a standard local, private python installation for the purpose.

  204. Re:Don't do it... by parlancex · · Score: 1

    You have a problem with those error messages? If those exceptions look "worthless" to you then I would argue you don't really have any business automating anything remotely serious, and as such you probably have only the most basic programming experience. Powershell is completely self discoverable, meaning if you had taken about 5 minutes to read any introduction to the language you would have become acquainted with commandlets like Get-Help, Get-Command, and Get-Member. If the output of THOSE commandlets is "worthless" to you then you really are beyond hope. If you want to criticize Powershell be my guest, but try to do it for it's actual shortcomings instead of made up nonsense, like performance, or it's clunky remoting.

  205. Re:Don't do it... by @madeus · · Score: 1

    While writing software on Windows is always fairly hideous (especially for mass distribution, i.e. outside of a corporate environment) AutoIT is vastly underrated.

    It's used quite a bit - for installer bootstraps (e.g. to do checks before running the MSI's) and on the AOL (UK) signup / support CD's.

    By the standards of most UNIX utilities at ~ 500 KB (without compression) for small .exe's it may be a little on the large size (often the app it self I'm installing is only about 1.5 MB, and 500 KB of THAT is the MSI) but you can write something that will deploy on Windows XP (SP0+) through to Windows 7 and work very reliably with minimal development effort.

    It's cute that it has a 'perlesque' syntax too (it's a sort of slightly horrible combination of Perl+PHP+VB, but which is immediately familiar to anyone with Unix shell scripting experience). The forums are pretty helpful places, and there are great examples of libraries from everything from simple SOAP clients to Blowfish implementations.

    In practice, it more than makes up for the overhead, because effort can go into making better software, rather than spending days coming up with a simple but reliable utility that works on Windows XP SP0 through SP3 + Vista + Win 7, at various user levels (guest standard, admin, guest - with and without UAC) with no dependancies. Due to how much Windows XP has evolved, even if you support only SP2 and above there are large number of dependancies that are not always guaranteed to be there (different versions of Windows Installer, .NET, network support, small patches with fixes you may be relying on without knowing it, etc).

    The only major deficiency I find in AutoIT is that while GUI support is enough to be useful, but there is no GUI development interface. Some might argue that's for the best - Real Studio probably better fit's the needs for any serious application development for anyone who isn't ready (or doesn't want to use) Visual Studio for a project. AutoIT is superb for administration, automation, small purpose built utilities and for quickly developing tools to compliment existing software though.

  206. Re:Don't do it... by @madeus · · Score: 1

    Thanks, that's interesting that there is a COM interface to Windows Update and it's that easy to query from PowerShell.

  207. Re:Don't do it... by @madeus · · Score: 1

    Check out the MSI API's. You can list versions there and handle upgrades/rollbacks just like you would with something like Solaris pkg's (not as automagic as apt-get + dpkg or yum + rpm, but scriptable and it's possible to do rollbacks and decent enough error handling).

  208. Re:Windows Automation by telekon · · Score: 1

    Fair play to you, sir.

    --

    To understand recursion, you must first understand recursion.

  209. Re:Don't do it... by DAldredge · · Score: 1

    What other things are needed to "match Linux"?

  210. Hamilton C Shell by Anonymous Coward · · Score: 0

    It's a native Win32 port of tcsh, with a bunch of the *nix tools you like. The downside is a) it's csh and b) you have to either pay $350 for a shell or pirate it.

  211. Re:Don't do it... by Anonymous Coward · · Score: 0
    I assume you either work for ms or are closely associated with them since you've been shilling for them for so many years here. That being the case, it's not in my interests for your product to be truely competitive. Fortunately, it isn't.

    tl;dr eat shit

  212. Exchange + Sharepoint = PowerShell by Anonymous Coward · · Score: 0

    The poster specifically mentioned exchange and sharepoint. Microsoft has created special PowerShell extensions just for those products. Not only can it leverage WMI, VBS and the rest of the windows alphabet soup, but powershell is a hell of a lot more secure out of the box (i.e. no Win server will execute powershell code unless the execution policy is set and the code is trusted within that scope).

    PowerShell is a very, very concise language. Most of my VBs scripts could be compressed from fifty or 100 lines down to 3 lines or so. It's completely different syntax than anything else, but overall it's where the industry is headed.

    I highly recommend you pick up a book or two on it, it's not hard to learn, but 9 times out of 10, you are trying to do the exact same thing someone else has already done very elegantly.

    For enterprise stuff, make sure you are using code signing and ideally scoping your execution policy to accept only signed code from your company.

    As far as scheduling, Windows Task Scheduler = Cron (ok, so maybe not 100% equal, but that's what us Win guys use to kick off scripts).

    Also, you are probably in the wrong place to ask for Windows Enterprise advice, just an FYI.

  213. Re:Don't do it... by PaladinAlpha · · Score: 2

    Are you trying to be dense? What's in the XML?

    Or, alternatively, "Yeah, Plain Text is really proprietary, impossible to decipher without reverse engineering; the worst format for interoperability."

    We're talking about theoretical improvements of PowerShell, and this whole thread was about .NET bits autoparsing XML. Once you move away from .NET you're exactly piping plaintext (like *nix) except you have to parse a whole XML tree to get it.

  214. Re:Don't do it... by darkpixel2k · · Score: 1

    That is a lot of hate for something you obviously do not know a lot about.

    GP was mistaken. The command is actually Add-PSSnapin and the specific command could be written as

    Add-PSSnapin VMware.VimAutomation.Core

    Note how no parameter names or quotes were necessary (but still allowed).

    I have used it enough when dealing with Exchange to realize it has absurdly long commands and parameters regardless of how the original poster screwed up his example.

    No, that would merely set up completion. A PowerShell snapin is actually a module which can have private namespaces to avoid collision in a global namespace, it can define new drives and providers etc. It is much more than completion. In fact, completion has nothing to do with it, completion will work even for script files which define parameters without any completion registration.

    It seems like completion to me. You obviously know Linux too--so after I've done an {apt-get install | yum install | etc...} a program would be available for basic autocompletion like vmware in this example. You could type new[tab] and find new-vm. If the application installed autocompletion files, you could autocomplete parameters too without having to type in special load statements in bash.

    In Windows it appears (at least from that example) that you have to install the program, then tell it to specifically load vmware related commands, objects, or whatever. I'm not saying it's a huge sticking point, but it appears to take much more work to define your automation in Windows verses Linux.

    PowerShell is just being extremely consistent, something Unix could learn a lot from! And PowerShell usually takes fewer keystrokes.

    As an example: I can only think of one utility in Linux that doesn't use '-r' for recursive actions on files. 'ls' uses '-R' for recursion and '-r' for reverse sort.

    Don't be fooled when someone shows you a command and spells out all of the parameter names in full. That is usually just because they tab-completed them. PowerShell supports both consistent shortening of parameter names, parameter aliases as well as positional parameters.

    I suppose you can type '--recursion' or '--recurse' in Linux.

    All of these in a very consistent and predictable way. This even goes for your own scripts and functions. PowerShell automatically infers parameter names from the command definition - i.e. there is no need to register external completion. You need to do the latter in traditional shells because the commands lacks parameter metadata.

    That's hardly a selling point for automation.

    I'd still rather type 'postconf message_size_limit=1000000 mailbox_size_limit=100000000' than something like:
    Get-AdSiteLink | Set-AdSiteLink -MaxMessageSize 40MB
    Set-TransportConfig -MaxReceiveSize 40MB -MaxSendSize 40MB
    Get-RoutingGroupConnector | Set-RoutingGroupConnector -MaxMessageSize 40MB
    Get-ReceiveConnector | Set-ReceiveConnector -MaxMessageSize 40MB
    Get-SendConnector | Set-SendConnector -MaxMessageSize 40MB
    Get-Mailbox | set-mailbox -MaxSendSize 40MB -MaxReceiveSize 40MB


    Either one can be stuck into a script and double-clicked on a new machine I suppose. I've never played around with Microsoft's SMS tools because they are ridiculously expensive--but with Puppet, Chef, CFEngine, etc... I can easily write 15 lines in Puppet that allow me to manage any postfix options. Another 10 lines and I can setup classes of machines for specific postfix configurations like spam filtering for crappy Exchange 2003 servers, full-on mail servers, mail relays, etc...

    To automate our Postfix spam filter deployments, I setup a reference machine and tested it. Then I configured puppet and used a virtual machine to test my configuration making a few tweaks here and there. Finally I deployed a second live machine using my puppet con

    --
    There's no place like ::1 (I've completed my transition to IPv6)
  215. Re:Don't do it... by EvanED · · Score: 1

    By the same token, "works the same way as what Ken Thompson decided in 1970" does not mean better. In the case of Powershell's object pipes, I give a number of benefits.

  216. Re:Don't do it... by Sam+Douglas · · Score: 2

    Powershell might be better than cmd batch files, but don't expect to be able to write a script that will run on machines that haven't had Powershell explicitly installed. I attempted to use Powershell for a simple automation task, but couldn't write a script for automating something and expect it would work at all on a client's machine like I probably could if it were a Unix shell.

    Running software in Windows is a massive pain because there is no good way for the shell to find commands, so scripts that depend on external programs need to jump through hoops to find the appropriate binaries.

    I ended up whipping up a quick program in C# to do the automation; it took less time than trying to figure out Powershell, didn't require many dependencies and could provide UI for selecting directories etc.

  217. python on windows by Anonymous Coward · · Score: 0

    Doesn't python work on windows? I don't know about integrating with sharepoint or outlook though them programs is bad.

  218. Re:Don't do it... by StuartHankins · · Score: 0

    You missed the point yet again. I'm beginning to think you're being intentionally thick. While you've hem-hawed around the points I originally made, you can't do basic things such as produce a list of updates available to a system. This PowerShell relies on a hefty library of framework objects for pretty basic stuff. It's meh at best, and the more I hear about how exciting you think it is, the more I think you're simply a Microsoft fanboy trying to promote another half-assed tool.

    But please do wake me when you feel you might have something interesting or insightful to add to the conversation. So far it's smoke and mirrors and I'll have no more of it.

  219. Re:Don't do it... by JWSmythe · · Score: 1

        You haven't been paying attention to the United States Congress lately. Besides shoving an official religion down the throats of Americans, they've also begun to torpedo woman's rights. There are now several things that women are not legally allowed to do without "a male family member". If you do not have a male family member available to sign off on what the female thinks she wants, the court will appoint a male representative.

        I'm not saying I agree with either. I can't provide the specifics off the top of my head, but my girlfriend has been watching the issues carefully, and sending complaints to all congressional representatives involved. It's not because she's any kind of crazy fringe womans rights activist. It's because our government is coming out with some really fucked up laws.

        The current Congress is trying to rapidly turn womens right backwards over 100 years. I wouldn't be terribly surprised if in the next 20 years it was turned back so far that women aren't allowed to drive, work outside of the home, or be allowed in public without a male relative present.

    --
    Serious? Seriousness is well above my pay grade.
  220. Re:Don't do it... by ToasterMonkey · · Score: 1

    Really? How's Amazon doing it?

    Which API is that? Amazon's...
    I'm a Puppet admin, I know what can be achieved with some hard work, but it is no thanks to Linux vendors/maintainers.
    My issue is that the abstraction that makes this happen has to be bolted onto a unix system and if users modify the underlying configuration files the results are hard to predict. I assume Amazon's cloud resources have the same problems if you go outside their API to change things.

    On the return codes, I asked how do you know if something got installed or not, 0/1 does not tell you this.
    0 also means there was nothing to update (success). At the very minimum I expect 0/1 for any CLI utility, but yum's output is not suitable for processing by other commands, so there should be a lot more return codes. We get crap for feedback, and this is a core OS utility, and a core function. This problem however seeps all throughout Linux.

      I wish Linux was more like Solaris in a lot of ways. Return codes, relative stability of any interfaces, stuff like that should be in all man pages not just really really old ones :\ I'm not saying Solaris is perfect, hehe, just a lot more mature.

    You have a good point with Exchange vs. your linux mail server, but this is going outside the OS discussion and Exchange does a whole lot more than a typical unix mail server. Exchange even has an API to do "quiesce yourself so I can do a backup" where about any given Linux solution has "just grab the flat files and we'll pretend this integrity thing isn't really an issue". That is pretty typical of any Linux program.. flat files are "good enough" without further consideration of locking (visudo, vipw, etc, barf yack gross)

    I love working with unix man, and I dig the whole everything is a file thing, but it's time to move on. We can keep configuration settings in flat files (hopefully the same syntax this time?), and still improve a LOOOOOOOT. You can have stable interfaces, command line AND programmatic AAAAAAND still have flat file backends with a universal syntax. You can even have a system where applications are notified when your configuration changes and still have flat files.

  221. Re:Don't do it... by ToasterMonkey · · Score: 1

    The mouse is almost 50 years old. You'll have to be way more specific about what's actually wrong with the interfaces that exist, standard or otherwise.

    Um... UNIX, POSIX.. then all the non-standards since then. I didn't think I'd have to explain that..

    99% of all tasks I want to schedule with something like Cron need to run hourly or daily. It is a one-liner to add an hourly, daily, weekly, or monthly cron job. Oh, and there's a cron.d on my system.

    Ok, on all the systems where task foo is enabled, change the minute to random(60)
    Puppet can do this, and their crontab handler is not a simple piece of code. I imagine you simply cannot do this or put way too much faith into search/replace.

    Erm... if you say so. I mean, I can also put my entire cron configuration in version control -- hell, I can put my entire /etc under version control, and I can get meaningful diffs/patches, comments, etc. Can you say the same for Windows configuration?

    Flat files are great for all that stuff - versioning, backups, etc, but that isn't configuration management. You can't just diff two sudoers files and figure out the effective differences. Nor httpd.conf, nor sendmail.cf, etc x1000 diff config syntaxes. Logically it is IS easier to diff exported registry settings, or Java property files.

    Heh, tell me if the bonding settings are identical for any two Linux network interfaces. Pssst! Check both modprobe.conf and ifcfg-*! Do they actually match the running configuration?

    Write a script to detect wether your sudoers file is vulnerable to this: http://sudo.miscellaneousmirror.org/sudo/alerts/runas_group_pw.html
    Or pick any other soduers vulnerability from the past year. HINT: everything on that example line can be expanded into god-only-knows-what, so you will have to reimplement a good chunk of the sudoers parser.
    But hey, you can do "echo >>" so you're all set right?

    Yes, and you can install Kerberos on Linux.

    Yah, and I won't hold my breath while you find ten Linux apps that support Negotiate authentication, much less ISV apps.

    I find it really bizarre that you can say that in the same breath. Nondeterministic... so other APIs are deterministic? What do you mean by that?

    In the sense that across a datacenter with multiple slightly different Linux distros and different patch levels, and hundreds of different BARELY parseable configuration syntaxes, you NEED a tool like Puppet to get anything done somewhat reliably, and those guys do a LOT of work laying down a sensible interface to a pile of random crap. You cannot manage a Linux datacenter with just "echo >>" and grep. No, you can, but BADLY.

    Probably couldn't get it from that one command, but I could check the status before or after the fact:

    I meant yum update, and did that actually do anything. The easiest way is to check mtime on /var/log/yum.log afterwards, and "then should I reboot or not" is some fun with "lsof | grep path inode"
    It works but checking mtime on a log file to tell if an action was performed or not is STUUUUPID.
    This is a "unix" system right? Why is the output unparseable? Why no detailed return codes?
    0/1 is the bare minimum anything should have, that does not give any application specific information.

    Oh, and... OS updates... Say, when can I expect an API to deliver my app via Windows Update, hmm? At least updates to it, if not the full installation?

    http://www.microsoft.com/systemcenter/en/us/overview.aspx
    That's addon software akin to Puppet but apparently way more advanced. So discounting addons, Linux wins on software distribution and loses on programatic configuration. Um... I'll just let you decide which one has more value and leave it at that. *goes back to tooling with custom Puppet module to manage something done easier on Windows...

  222. Re:Don't do it... by Anonymous Coward · · Score: 0

    Because all men can afford to support a woman, in the USA, right? We're not worried about women's rights here. You guys need us to get the real work done and to bring home the bacon.

    Male==Fail.

    That's why women are free in the first place. Men don't want us to be, but you're all such a bunch of total fuckups you really have no choice.

  223. Speaking of syntax... by Anonymous Coward · · Score: 0

    Of your sixteen uses of the word 'your' (possesive), it was only used six times correctly. The other ten times, you meant 'you're' (contraction of 'you are'). The content of your post seemed intelligent, but your delivery makes it seem as if you're uneducated, or uncaring/lazy in your writing.

  224. Re:Don't do it... by Anonymous Coward · · Score: 0

    I am not terribly familiar with remote package management, but would rpm be more explicit or useful for what you're doing?

  225. Re:From unix to windows.... by Anonymous Coward · · Score: 0

    What MSFT lover modded this troll? This man speaks truth in volumes.....

    Powershell SUCKS SUCKS SUCKS SUCKS... only a braindead turd burgle would disagree with that.

  226. Re:Don't do it... by godefroi · · Score: 1

    Powershell might be better than cmd batch files, but don't expect to be able to write a script that will run on machines that haven't had Powershell explicitly installed.

    Just like you shouldn't expect bash scripts to run on a machine that hasn't had bash installed? Server 2008 and Windows 7 have it installed by default, FYI.

    --
    Karma: Poor (Mostly affected by lame karma-joke sigs)
  227. Re:Don't do it... by godefroi · · Score: 1

    PowerShell 2.0 is included in Server 2003 SP2, Vista SP1 and XP SP3. So assuming your machines are properly patched, you've got it.

    --
    Karma: Poor (Mostly affected by lame karma-joke sigs)
  228. Re:Don't do it... by godefroi · · Score: 1

    2.0 is included in XP SP3.

    --
    Karma: Poor (Mostly affected by lame karma-joke sigs)
  229. Re:Don't do it... by DriveDog · · Score: 1

    JScript is also available by default. I think it beats VBScript by a long shot (and I've programmed a lot more VB than JavaScript), and has access to all the same Windows (and MS Office) objects. The MSE7 editor/debugger is available if MS Office is installed, and isn't too terrible for throwing some JScript or VBScript together. What's more, you can mix or match JScript, VBScript, and others (Rexx, Perl, etc.) that are not installed by default.

  230. Re:Don't do it... by SanityInAnarchy · · Score: 1

    Um... UNIX, POSIX.. then all the non-standards since then. I didn't think I'd have to explain that..

    You still haven't. Again, what is actually wrong with these interfaces? And if you're going to include that much history, can't I also cite the mess that is Win32?

    Ok, on all the systems where task foo is enabled, change the minute to random(60)

    Why would I ever want to do that?

    Puppet can do this, and their crontab handler is not a simple piece of code. I imagine you simply cannot do this or put way too much faith into search/replace.

    Also not really seeing the problem with that. In fact, crontab is already in a format which can be trivially read with grep, so I see little reason it couldn't be fixed with sed.

    I'm also not sure why this is really an issue when you mentioned that Puppet already solves your problem.

    You can't just diff two sudoers files and figure out the effective differences.

    Unless they're dramatically different, it kind of does. And what are you comparing this to?

    Logically it is IS easier to diff exported registry settings,

    Really? Sudo vs exported registry settings? Unless you're going to get very specific about which registry settings we're talking about, I don't see the advantage -- the registry is otherwise about as useful for diffing as the entire filesystem.

    Also, while I'm not sure how common it is, I am starting to notice tools with the ability to dump their configuration -- for instance,

    Regardless, what I can do here is stuff an entire /etc into version control, then push out a given branch of that to give me a preconfigured machine. I'm sure tools exist to do something similar in the Windows world, but you're not going to get there by dumping arbitrarily fine chunks of the registry.

    Heh, tell me if the bonding settings are identical for any two Linux network interfaces. Pssst! Check both modprobe.conf and ifcfg-*!

    I can go one step further:

    grep -rl 'eth[01]' /etc

    Now I know where to look for any differences between those interfaces -- which services are running on each of them, probably which ports are open on each of them, and so on.

    Write a script to detect wether your sudoers file is vulnerable to this:

    Wouldn't it be easier to update sudo? Also, the impact looks pretty fairly minor -- I don't have to enter my own password when logged in as myself to switch to... myself... but a group I'm not a member of.

    you will have to reimplement a good chunk of the sudoers parser.

    Possibly -- though this has largely been done, takes about 5 minutes on Google to find various sudoers parsers. That does suck, though -- postfix, for example, has a command which dumps all config values in an easily-parseable format.

    you NEED a tool like Puppet to get anything done somewhat reliably,

    Your example so far of something for which you need a tool like Puppet is... well... setting a cron job to fire at some random minute instead of at the same minute.

    And what is wrong with needing Puppet, if that's the case? That fits perfectly well with the Unix philosophy -- why would you build that functionality into the system, if you can have a third-party tool that works just as well?

    I meant yum update, and did that actually do anything.

    I got that. Why doesn't my suggestion work?

    The easiest way is to check mtime on /var/log/yum.log afterwards,

    Doesn't mean it's the right way. That'll tell me whether it "did anything", but not whether it did what I want.

    "then should I reboot or not"

    Ubuntu Serv

    --
    Don't thank God, thank a doctor!
  231. Re:Don't do it... by marcello_dl · · Score: 1

    PS surpasses bash in terms of language features? Sure, bash is more a collection of commands than a language. If you need object orientation, remoting for automation purposes you get ruby or newlisp, iolanguage or a dozen other languages. But Windows and OSX automation do not surpass a FOSS unix environment because total control in the hand of the sysadmin is against the interest of the OS and applications owners. Possibly, powershell exists because and until bash does.

    --
    ---- MISSING MISCELLANEOUS DATA SEGMENT --- [sigdash] trolololol
  232. What's scarier? by Thu+Anon+Coward · · Score: 1

    I'm not sure what's scarier.

      The fact that this guy is on essentially a *nix site with knowledgeable *nix users to ask for help but he's asking for Windows help....

    or

    the fact that a lot of the people posting answers to his question are obviously M$ knowledgeable and posting answers to his questions on a *nix site....

    . .. ... /. has been invaded by the M$ Borg

    --



    I'm good with numbers - .45, 7.62, 9.....
  233. C# does it all by Anonymous Coward · · Score: 0

    If it's not in the .net framework, you can easily utilize c/c++ libs, also inserting jsp/html/vb is just as easy. And if you need more raw manipulation the Win32 libs via c/c++ work just as well.

    I've created many automated applications in C# and have yet to find anything I cannot do...

    1. Re:C# does it all by Anonymous Coward · · Score: 0

      oh, and you can insert any powershell or wmi... of course you'll have plenty of newbs that say 'wmi! powershell! wql! is all you need'
      but those are just as limited as any language. C# isn't necessarily the language, but the 'glue' that can bind them all together....