Tag: syndicated

  • Powershell in a Month Day 17 – Security Alert

    This is part of my Powershell Challenge, to learn more about PowerShell (PoSh) using the Learn Windows Powershell 3 in a Month of Lunches book by Don Jones.

    Security. It’s important, and I was thinking this chapter would show us more about changing security. Instead, this chapter is really an outline and discussion of what security method are built into the PoSh shell. The chapter first emphasizes that the PoSh environment doesn’t bestow and special rights or abilities to the executor. The commands just execute, or fail to execute, base do on the rights you have in windows already. I can see that as some of the commands I run at times fail when I haven’t run the shell as an administrator.

    From there the chapter talks about the different execution policies, which I haven’t thought much about. I end up typically changing the execution policy on each VM initially so I can run scripts to Unrestricted. I know that isn’t recommended, but I typically need things to just work.
    I also hadn’t realized that I could set this in a GUI in Windows. That’s good to know, and I suspect, it’s another example of where Windows is implementing PoSh commands under the hood of the GUI. It would be nice to see a Trace for PoSh to watch commands come through GUI actions.
    The chapter finisheds by talking about the digital signing of scripts, how it works, and what you need to do. I haven’t messed with this and it’s not a part of the lab, but it’s something I’d probably do in a large organization, or even any organzation to be sure that hte code that’s being automated and run is actually the code that has been tested.
    Overall, a short chapter. Slightly informative, and definitely an easy day.
  • Building a Virtual Lab with Hyper-V

    I needed to get this one on Hyper-V, so I decided to document the process. I’ve put together a series that looks at the steps I took.

    This will fill in as I go through the process, so if there’s something you don’t see, it’s coming.

  • Powershell in a Month Day 16 – Working with many objects

    This is part of my Powershell Challenge, to learn more about PowerShell (PoSh) using the Learn Windows Powershell 3 in a Month of Lunches book by Don Jones.

    One of the great powers of T-SQL is that we can owrk with many rows at once. We use a query to tell the server what we want done to a group of objects, and then the query executes against every row that matches the filters. It’s this power that makes SQL much more efficient than the RBAR method of moving through a cursor structure. This chapter introduces the ways in which we do that with Powershell.

    The first part of the chapter is about batch commandlets, using things like Stop-Process receiving a pipeline of objects from something like Get-Process. I like their favorite example, which I’ve yet to run. I need to do this in a VM and see what happens.
    Get-Process | Stop-Process
    That’s an easy concept for me, and I see how valuable this is. However not all of the cmdlets we call will handle batches. The next part of the chapter examines WMI and the Invoke-WmiMethod call, which can take a series of objects as well. I somewhat dread the idea of needing to use this method, or worse, having to call a series of methods in which I have to pass in all the parameters. It’s good to know that I need the $null parameter for those parameters I don’t want to deal with, but it’s an ugly syntax. It’s handy to know this is an option, but I think I’ll be doing MSDN research for those times that I need to work with these methods.
    The next part of the chapter looks at the ForEach-Object syntax. I’ve seen this in scripts, and I could guess what i does, but this starts to make sense now and I can more easily decode the scripts when I see them. Along with the $_ marker to represent an object, the whole structure of PoSh is becoming easier to read.
    The chapter isn’t long and and starts to spend time comparing the various methods of enumeration. That’s helpful. Seeing how the same end result can be achieved in different ways is very handy. The lab was easy, though I had to skip the WMi stuff as I was unwired at the time that I went through this chapter. However I had an idea of what to do, just no way to look up the WMI classes.
  • T-SQL Tuesday #51 – Place Your Bets

    tsqltuesdayIt’s T-SQL Tuesday time again and Jason Brimhall is hosting this month’s event. He used to live in Las Vegas, and with that theme in mind, he calls for you to Place Your Bets.  That’s a time when someone has gambled, or risked something on an application, venture, process that relates to SQL Server? When have you done something that caused an issue you could have avoided?

    It’s an interesting topic, and I’m looking forward to reading what people write.

    T-SQL Tuesday is a monthly event, the second Tuesday of the month, started by Adam Machanic (blog|twitter). You can participate by setting up a blog and writing on the month’s topic. Check Twitter for the #tsql2sday hash tag or look for the blog postings with a search.

    If you want to host, contact Adam.

    The Big Bet

    I didn’t place this bet, but a bunch of application designers and management did. I came in to the company late, and realized we had issues, but wasn’t able to effect change in any short order.

    I worked for a large software company. Large as in thousands of employees, and certainly hundreds of developers. Most were engaged in writing the software we sold, but there were plenty of people engaged in managing our internal systems and writing software that we were using internally. One of these was our internal Intranet site for employees.

    This was a large project, replacing a number of applications, and designed to be a central point of information where employees could turn and various departments could publish information. Being a software company, we knew that it’s worth paying for software that’s written and we chose a framework that would cover many of our needs, but allow us to customize parts of the site for use by different departments. All in all, a CMS-type system that would fit our needs.

    The project started before I did, and no one consulted me or my group, as the production DBAs, as to the architecture, hardware spec, or anything else. It’s not that we should have, or would have, led the way, but we could have offered opinions about how things might perform.

    The day of the roll out came. I was told which day it was and never participated in any testing. The global policy was changed to set everyone’s default browser to the intranet, and I came into work expecting to find a new site where I’d see information posted, resulting in (I hoped) less emails from various departments. Not long after I arrived, I was pulled out of a meeting because of performance problems.

    I had no idea what to look at on the site, but we found CPU pegged and very high I/O on the server. I decided to run a short Profiler trace from my machine to get an idea of what the workload was and what we might look to run. I found fairly simple queries, lots of SELECT * to a few tables. What was interesting was that the queries were scrolling rather quickly on the screen. I found that the default trace values in SQL Server 2000 were storing around 25MB/sec worth of data on my local hard drive.

    In 2001, this was a fairly large load on a SQL Server 2000 instance. When we checked the tables and calculated result sets, we found very little data from each query. There were missing indexes, but even adding those to tables that were a few hundred rows of data didn’t help. The problem was simply that so many employees, each hitting the server by default, with a series of sidebars on the web pages, each of which created its own connection, ran its own query, and ran lots of them on each page, was simply overloading the hardware.

    If was bad design, poorly tested, and not well thought through. Even simple caching mechanisms as Brent Ozar has talked about would have dramatically removed a lot of the load. In the end, those weren’t really needed. What we found was that the majority of the information being returned by queries changed less than once a week. A few weeks of development time removed most of those queries and had them replaced with static XML files that were loaded by the application for display, and could be updated from the database by an administrator.

    Ultimately the site worked well, and we did get less emails from various departments since announcements could be made on the Intranet, which most of us learned to check once or twice a day.