SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Stairway to SQL PowerShell Level 1: SQL PowerShell Basics


Stairway to SQL PowerShell Level 1: SQL PowerShell Basics

Author
Message
dbaduck
dbaduck
Right there with Babe
Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)

Group: General Forum Members
Points: 771 Visits: 280
Comments posted to this topic are about the item Stairway to SQL PowerShell Level 1: SQL PowerShell Basics



Ben Miller
Microsoft Certified Master: SQL Server, SQL MVP
@DBAduck - http://dbaduck.com
Michael Meierruth
Michael Meierruth
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1714 Visits: 2516
I think I will follow this series. It makes it look all very simple. And I'm curious to see what you can do with it in regards to SQL Server.
Just one minor omission: you make reference to Fig 1.3 but the figure is not pesent.
dbaduck
dbaduck
Right there with Babe
Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)

Group: General Forum Members
Points: 771 Visits: 280
Thanks. I have submitted to have the graphic re-added to the level.



Ben Miller
Microsoft Certified Master: SQL Server, SQL MVP
@DBAduck - http://dbaduck.com
derek.colley
derek.colley
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1486 Visits: 603
Thank you, the timing for this couldn't have been better as I'm looking into Powershell now, it's an area I've been avoiding too busy to concentrate on :-) Thanks for the stairway, I'll be following the series.

I'm also finding Sean McCown 's videos to be very useful, he's got a fair few demos online on using Powershell, from basic stuff to more detailed SQL Server uses. http://midnightdba.itbookworm.com/AllVids.aspx, search for 'Powershell'.

---

Note to developers:
CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
So why complicate your code AND MAKE MY JOB HARDER??!Crazy

Want to get the best help? Click here http://www.sqlservercentral.com/articles/Best+Practices/61537/ (Jeff Moden)
My blog: http://uksqldba.blogspot.com
Visit http://www.DerekColley.co.uk to find out more about me.

dbaduck
dbaduck
Right there with Babe
Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)

Group: General Forum Members
Points: 771 Visits: 280
Thanks.

I will be posting some videos related to my stairway at my youtube channel http://www.youtube.com/dbaduck and at http://dbaduck.com as well.

I know Sean and have seen his videos.
There will be more levels posted soon.



Ben Miller
Microsoft Certified Master: SQL Server, SQL MVP
@DBAduck - http://dbaduck.com
rehman-615909
rehman-615909
SSC-Enthusiastic
SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)

Group: General Forum Members
Points: 135 Visits: 209
Thanks for the nice series. I wanted to learn this since a long time. I think that time has arrived now.
I tried the examples in this first article. Everything worked fine except at the end, when I tried to edit profile. Notepad just informed me that path doesn't exist and didn't give me any option to create new file. What should I do?
I am using Win7 and running PowerShell as administrator.
Thanks.
dbaduck
dbaduck
Right there with Babe
Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)

Group: General Forum Members
Points: 771 Visits: 280
You should be able to from a PowerShell window run the following and then do the notepad $profile thing.

New-Item $profile -force -type File
notepad $profile



Ben Miller
Microsoft Certified Master: SQL Server, SQL MVP
@DBAduck - http://dbaduck.com
rehman-615909
rehman-615909
SSC-Enthusiastic
SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)

Group: General Forum Members
Points: 135 Visits: 209
After fixing a few typos, I was able to get the expected result.Thanks.
One think I noticed is that, in the profile script, $Host.Name is appended twice. I guess it was an oversight.
Thanks again.
dbaduck
dbaduck
Right there with Babe
Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)

Group: General Forum Members
Points: 771 Visits: 280
I will see about getting the example changed to not be redundant.

Glad things worked out.



Ben Miller
Microsoft Certified Master: SQL Server, SQL MVP
@DBAduck - http://dbaduck.com
williamn
williamn
SSC-Enthusiastic
SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)

Group: General Forum Members
Points: 122 Visits: 42
I noticed this, too. I played around a bit trying to get the version (major & minor) included in the title as described and arrived at this:

$wintitle = $CurrentUser.Name + " " + $Host.Name + " " + $Host.Version.Major + "." + $Host.Version.Minor
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search