A post he hasn't written yet has been deleted.
Best posts made by Martin9700
-
RE: So, working on a little Node.js project...anyone have any experiences to share?
I'm concerned that something is missing from your Network Scan though. This is a cool feature, though!
-
RE: So you need a simple SMTP relay test? You can do it with P0werShell!
Port parameter wasn't introduced until PowerShell 3.0, so you'll need to make sure you're on at a minimum of that before this will work. PowerShell 4.0 is the current version and 5.0 is coming out SOON. So if you're still on 2.0, upgrade now!
-
RE: PowerShell command: Event Time
@g.jacobse said:
0x01d0b26dc6a4a844
That value isn't a .NET date/time value so Get-Date won't be able to process it properly (hence the year 0415). So I tried this: http://superuser.com/questions/398983/how-do-i-decode-the-faulting-application-start-time-in-a-windows-event-log-ent
(get-date "01/01/1601").AddSeconds(0x01d0b26dc6a4a844 / 10E+6)
And got:
Monday, June 29, 2015 1:16:14 PM
Seems much better!
-
RE: Understanding $args in PowerShell
Let me take a stab at explaining an array. It's just a list. When you write your groceries on a piece of paper you have a variable with multiple values on it. You don't write a single item per piece of paper, right? If you did that'd be a regular variable. Instead you put the whole list on one piece of paper, making it an array/list.
Computers are great with lists, but they have some limitations, and they have to be told to do things in a very literal sense. So, grocery list is:
$GroceryList = "beer","wine","whiskey","brandy","vodka","chips"
In PowerShell, the comma's are what tell PowerShell that this is an array. Now, if I ask you what's the 3rd item in the list, you would scan through and count each one, until you got to "whiskey". PowerShell is the same way, but we can jump straight to the third item. Try:
$GroceryList[3]
The brackets with the number tell PowerShell that you want to reference a particular item in the array. The number tells you which item. So we got Whiskey, right? If you tried it, you know we got "brandy". WTF? In programming languages, and this is pretty much universal, arrays always start at zero. So $GrocyerList[0] is beer, $GroceryList[1] is wine, and last $GroceryList[2] is whiskey. So when working with arrays you'd really want to:
$GroceryList[2]
To have PowerShell return the 3rd element. Each item in an array is called an element, by the way. Looking back at Scott's code, what he was doing was creating a For/Next loop, which is a loop using a number as reference.
for ($i = 0; $i -lt $GroceryList.Count; $i ++)
Is some goofy looking stuff, but the first part $i = 0 marks our starting point. $i = 0. The next part is a IF statement, that as long as it's true we'll continue the loop. In PowerShell we have built in properties, and one of those is Count which tells us the number of elements in the array. So as long as our $i variable is less then that count, we'll keep looping in the for loop. The last part $i ++ tells the loop, that when I'm done with the loop add one. The ++ thing is basically shorthand for $i = $i + 1.
Now PowerShell will continue to run the code contained in the scriptblock (all the code between the curly brackets) until our $i variable equals or is greater than the number of elements in our $GroceryList. So the first time through the loop $i = 0, we display that number, and we reference the element in our array that corresponds with zero. Which is beer. Loop ends, $i increments to 1, start again.
Loop displays the number 1, and shows the $GroceryList element that corresponds to that number, which happens to be "wine". Code block ends, $i increments to 2. This is still less the $GroceryList.Count (which is 6, btw) so the loop repeats. Onward until $i get's to 6, at which point it exits the loop and continues on with the script. In this case there is no more script, so it exits the script and drops you back into the shell.
-
More PowerShell Goodness...
If you love reading about improving performance in PowerShell (which admittedly isn't its strong suit) then you'll love these two posts. First one:
http://thesurlyadmin.com/2015/01/26/dynamic-fields-in-objects-what/
sets the stage. I talk about creating an object where the properties can update dynamically based on values in other properties of the object. It's THIS close to class, without the persistence or reusuability. And then with a little playing we discovered how cool this technique could be:
http://thesurlyadmin.com/2015/01/27/dynamic-properties-in-objects-and-performance/
-
Latest Blog Post: Shrink MS SQL Log Files with PowerShell
http://thesurlyadmin.com/2015/01/05/shrink-sql-log-files/
Since it's all about self-promotion, figured I'd put this out there to see what happens. Let me know what you think.
-
PowerShell.org announces it's 2015 Hero's
Couple of SpiceHeads (don't think either are here on Mango) just got recognized as 2015 PowerShell Hero's by PowerShell.org! Come congratulate them
http://community.spiceworks.com/topic/744795-powershell-org-announces-its-powershell-hero-s-for-2015
-
RE: Microsoft Sculpt Ergonomic Keyboard For Business
I use the Sculpt--probably about 3 weeks now--and for the most part it's great. I got the mouse that came with it and I highly recommend against getting it. It's rounded and actually forces you to bend your wrist which is what you shouldn't be doing! Ended up going back to my Logitech and it's fine.
The separate number pad sucks, but it does keep your mouse closer to the keyboard which is also highly recommended. I don't use the number pad as much as I used to but I am finding myself using it more and more as I get used to the setup.
Overall it's a good keyboard and I haven't had any hand pain since going to it, though I had some when I first got it and was adjusting to it.
Latest posts made by Martin9700
-
RE: Chinese Programming Cheerleaders
I'm trying to imagine how well this would go down here in the States.......
-
RE: Powershell Line Break at Comma
Should look into using Send-MailMessage for email. It's a lot easier to work with.
-
RE: PowerShell command: Event Time
@g.jacobse said:
0x01d0b26dc6a4a844
That value isn't a .NET date/time value so Get-Date won't be able to process it properly (hence the year 0415). So I tried this: http://superuser.com/questions/398983/how-do-i-decode-the-faulting-application-start-time-in-a-windows-event-log-ent
(get-date "01/01/1601").AddSeconds(0x01d0b26dc6a4a844 / 10E+6)
And got:
Monday, June 29, 2015 1:16:14 PM
Seems much better!
-
RE: How Often Is a Degree a Negative
@scottalanmiller said:
@Martin9700 said:
Did it help me get my first job in IT? Yes. I also wasn't 10's of thousands of dollars in debt so I'd say the program worked.
Personally I would defined "worked" only if it was able to get you into your first job sooner than an alternative approach. What if you had been teaching yourself and job hunting during the time you were in college.... could you have gotten a job sooner that way? People who go to college them get a job always say that the job helped them to get that first job, and sometimes surely that is true. But they rarely consider the cost of lost opportunity and wonder if they had not gone to college if that would have helped them to get a different first job sooner.
Well, kind of difficult to measure that one, tbh. But in those days getting into mainframe operations required you know some things about mainframes. It wasn't an industry that said, gee you can fix a PC (who had PC's?) I'll give you a shot. It was just a different time.
-
RE: How Often Is a Degree a Negative
But they are useful as a hiring manager as I don't speculate about college, I actually went, and I know when someone brags about having a degree that their bar for success is so low that they are immediately disqualified.
This seems really limiting. There's so many variables here that making a blanket statement like this is shooting yourself in the foot. What about the kids who are forced to go to college by their parents? Want about dumbshits that learned better after they got older? What about people who may actually agree with your (in whole or part) and include it on their resume because that's just how it's done?
But to get back on topic, I never went to a U, and just went to a vocational school (now defunct). Does it help me now? No. Did it help me get my first job in IT? Yes. I also wasn't 10's of thousands of dollars in debt so I'd say the program worked.
-
RE: Microsoft Sculpt Ergonomic Keyboard For Business
I use the Sculpt--probably about 3 weeks now--and for the most part it's great. I got the mouse that came with it and I highly recommend against getting it. It's rounded and actually forces you to bend your wrist which is what you shouldn't be doing! Ended up going back to my Logitech and it's fine.
The separate number pad sucks, but it does keep your mouse closer to the keyboard which is also highly recommended. I don't use the number pad as much as I used to but I am finding myself using it more and more as I get used to the setup.
Overall it's a good keyboard and I haven't had any hand pain since going to it, though I had some when I first got it and was adjusting to it.
-
RE: PHP 7 Feature Freeze and the current state of PHP 7
@scottalanmiller said:
Doesn't look too exciting as an update.
The guys own commentary is kind of amusing.
-
RE: 27 Useful Gadgets for SysAdmins
Not sure I've used any of that in the past year... except maybe the pen, and even that was briefly. Could use a better Keyboard, that's true. Microsoft Sculpt keyboard looks cool, but I don't like the detached number pad.