Learn about Windows PowerShell
Summary: In Advanced Event 2, you must find information about remote and local services.
About this event
Division
Advanced
Date of Event
4/3/2012 12:01 AM
Due Date
4/10/2012 12:01 AM
You are a server administrator for a medium-sized enterprise company. Your boss has tasked you with finding the way that all services on all servers start. You need to present your findings in a spreadsheet that includes the following information:
An acceptable output for this task is shown in the following image.
2012 Scripting Games: All Links on One Page
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. Good luck as you compete in this year’s Scripting Games. We wish you well.
Ed Wilson, Microsoft Scripting Guy
Hi Ed,
this looks ( at least on first sight :-) like a managable task!
What should be done, is definitely clearer than the first event, if I got it right ...
Anyway: A question I got on mind is: "May we rely on Excel being normally installed on the local machine where the report should be displayed?"
btw: "Is it Ok to assume, the data is consumed by Excel at all?"
Klaus.
re point: "If the script requires administrative rights to run..."
Is this something we need to determine and only add code if necessary?
Bit stuck on this one. There are a few ways that the account could have administrator rights, or in this scenario would the account be a member of the local administrators group? Also, "Your boss has tasked you with finding the way that all services on all servers start", does this mean an input file of server names is required or should the script discover server objects in AD? Or is it up to us? :)
Thanks!
@K_Schulte yes, it is a managable task :-) Yes, you can rely upon Excel being installed on the local computer where the report will be displayed. The picture above, shows a spreadsheet, and states that the output is acceptible. So it is safe to assume that the data is able to be displayed by Excel.
@Ken Hamilton Yes, you should determine if your script requires admin rights to retreive all the service information specified by the scenario on both a local and on a remote computer. If this task requires admin rights, then you should add the code to detect if the script possesses such rights while it is running. If the script does not have admin rights, then you should display a message and exit the script.
@Matt Hitchcock Yes, it is true that there are different ways the script could be running and have admin rights ... your task is to determine if the script has the rights it requires to successfully complete PRIOR to running the script and having it fail. If your script requires specific rights to run (either locally or remotely) then you must see if the script has those rights prior to execution of the script, and gracefully exit before displaying a bunch of access denied errors. The boss did not specify HOW you are to determine that you are querying all of your servers. Therefore it is up to you, you can read a text file, query AD, query a SQL Database, provide an prompt and type the server names in, whatever is appropriate for you. But keep in mind, that your script also must have NO external dependencies, and that judges will be running your script for score ... (the judges might not have Active Directory installed on their network, or they might not have a SQL database on their laptop) ...
Time to look at last year's submissions for 'comment-based help' help and another small novel for the notes section of it. If my thinking doesn't get fixed then my scripts will never get fixed.
@Chris Seiter Take a look at my Hey Scripting Guy blog posts. I have numerous posts about comment based help. In fact, I have a function in my ISE Profile that automatically adds help to a script. blogs.technet.com/.../searchresults.aspx
May we assume that PowerShell remoting is enabled?
@Alex McFarland yes, you can assume that PowerShell Remoting is enabled.
Would making the assumption that DNS or WINS is running within the environment count as an external dependency?
@Jeff Schulman I think that it is save to assume that name resolution works. If you are concerned, you can always use test-connection to ensure that you can connect prior to doing the "work" of the script.
When I browse 2012sg.poshcode.org/.../TopUsers, how is it that some people have 4 and 5 scripts rated already, even though only two events have been released so far?
@Ryan Ries ... no idea. I did not know this page was live yet. I will ask Joel.
Hi there,
The question about remoting led me to another question: can we assume that any / all firewall ports to remote machines are open, or could there be restrictions there?