Posts RSS Comments RSS 253 Posts and 411 Comments till now

The 2011 Scripting Games

The 2011 Scripting Games begin on April 4, 2011 and run through April 15, 2011. What is the Scripting Games, you may ask? Well simply put, the Scripting Games are the premier learning event of the year for IT Pro’s and others who wish to master Windows PowerShell. Comprising 10 events, a registered contestant has seven days to create a solution to a scenario driven problem and post their code to a MVP maintained script repository for evaluation by a panel of internationally recognized judges. Daily leaderboards and prize drawings help to maintain the suspense throughout the two-week international event.

 

During the 2011 Scripting Games hundreds of contestants will submit thousands of scripts that will be reviewed by dozens of judges. Hundreds of thousands of spectators from all around the world will view the games themselves. Last year, participants from more than 100 countries participated in the Scripting Games. With an emphasis on real world scripting scenarios and problems, the scripts will be of immediate value to both the participants and to the spectators.

 

Preparation for the 2011 Scripting Games is already underway, with a learning guide, step-by-step tutorials, videos and other resources being generated on a daily basis. The 2011 Scripting Games all in one page is the portal for the games themselves. The 2010 Scripting Games all in one page is still available, as are the events from the 2009 Scripting Games.

 

Its been awhile… what have you been up to?

Sorry I haven’t been blogging much. While I have been very busy at work my Powershell exploits have not been idle 🙂

Here are some updates 🙂

Anyway… I just wanted to give you a heads up on what was going on with me. Shortly I plan to have a weekly or monthly blog post covering my BSonPosh module which is up to ~140 cmdlets.

Back from the MVP Summit…

Man was it good. The flow of information was outstanding. There were a ton of sessions I wanted to attend, but I couldn’t do everything so I basically split my time between the Powershell PG and Directory Services PG.

Now… I know your all saying “While I am glad you had a good time… tell me the good stuff!” I appreciate that. I am currently am waiting for an email from the PG’s letting me know what I can and cannot discuss.

They like me, right now, they like me (Sally Field joke)

Just got the mail. It looks like I am MVP for another year 🙂

The orginal quote said “you like me, right now, you like me!”

Back From the MVP Summit

Well… Just got back from a week in Redmond. It was awesome!

First I want to thank MS for putting this all together. It was a testament to their commitment to the community and desire to see their products succeed.

While this was my first MVP summit, I did hear several others comment on how this was the best one yet.

I was VERY lucky to have a seasoned MVP vet (Dean Wells) show me the ropes and introduce me to some of the (IMO) smartest technical people on the planet. These guys/gals are not only incredibly smart… but they were an absolute blast to hang out with.

I doubt they subscribe to my blog but I wanted to do a shout out and link their blogs/Sites

Dean Wells: Absolute Great Trainer/Consultant http://www.msetechnology.com
joe Richards (joeware): http://blog.joeware.net/
Joe Kaplan : http://www.joekaplan.net/
Brian Desmond: http://briandesmond.com/blog/default.aspx
Laura Hunter: http://www.shutuplaura.com/
Mr Hunter (Mark Arnold) : http://markarnold.blogspot.com/
Gil Kirkpatrick (NetPro): http://www.gilsblog.com/
Ulf B. Simon-Weidner’s: http://msmvps.com/blogs/UlfBSimonWeidner/Default.aspx
Tony Murray (founder activedir.org): www.ActiveDir.org Blog: http://www.open-a-socket.com/
Little Jimmy: http://www.jimmytheswede.blogspot.com/
Darren Mar-Elia (SDMSoftware): http://www.sdmsoftware.com/blog/
Princess Jorge!: http://blogs.dirteam.com/blogs/jorge/
Brett Shirley: http://blogs.msdn.com/brettsh/
Eric Fleischman: http://blogs.technet.com/efleis/default.aspx (currently VERY slow to post)

I can not tell you (literally I am under NDA 🙂 ) How much I learned this past week.

What I can say is that for Powershell… the future is VERY BRIGHT!

The time with the Powershell Dev team was great. Again… can’t say much, but they have great plans.

I spent about 5hrs with the Active Directory team discussing their plans. If the AD Team can pull off what they have planned… OMG it is awesome. AD administration will never be the same.

The next version of SCVMM looks great.

Get-CitrixApplication.ps1 (Citrix Top 10)

This script returns Citrix Application Objects.
– With no -AppName passed it will return All application Objects
– With -AppName it will return all apps that match (regex.)

# Get-CitrixApplication.ps1
# Brandon Shell [MVP]
# www.bsonposh.com
# Returns Citrix Application Objects for AppName passed or RegEx
Param($AppName=".*",$server=$env:ComputerName)
$type = [system.Type]::GetTypeFromProgID("MetaframeCOM.MetaFrameFarm",$server)
$farm = [system.Activator]::CreateInstance($type)
$farm.Initialize(1)
$farm.Applications | ?{($_.AppName -match $AppName) -or ($_.BrowserName -match $AppName)}

Set-CitrixServerLogon.ps1 (Citrix Top 10)

Here is a useful little script. This Creates a MFCom Server Object and disables or Enables Logons for that Server.

# Set-CitrixServerLogon.ps1
# Brandon Shell [MVP]
# www.bsonposh.com
# Sets the Server to Enable or Disable Logons
Param($Server,[switch]$enable,[switch]$disable,[switch]$help)
function HelpMe{
    Write-Host
    Write-Host " Set-CitrixServerLogon.ps1:" -fore Green
    Write-Host "   Sets the Server to Enable or Disable Logons"
    Write-Host
    Write-Host " Parameters:" -fore Green
    Write-Host "   -Server                  : Optional. Server to Set Logon"
    Write-Host "   -Enable                  : Optional. Checks Hours of Idle Time (Default)"
    Write-Host "   -Disable                 : Optional. Checks Minutes of Idle Time"
    Write-Host "   -Help                    : Optional. Displays This"
    Write-Host
    Write-Host " Examples:" -fore Green
    Write-Host "   To disable the Logon for a Server" -fore White
    Write-Host "     Set-CitrixServerLogon.ps1 -server <serverName> -Disable" -fore Yellow
    Write-Host
}

if(!$Server -or $help){helpme;Write-Host;return}

Write-Host

Write-Host " Getting Server [$Server]"
$mfsrv = New-Object -ComObject MetaFrameCOM.MetaFrameServer

Write-Host " – Initializing Server"
$mfsrv.Initialize(6,$Server)

if($enable)
{
    Write-Host " – Setting to EnableLogon = 1"
    $mfSrv.WinServerObject.EnableLogon = 1
}
if($disable)
{
    Write-Host " – Setting to EnableLogon = 0"
    $mfSrv.WinServerObject.EnableLogon = 0
}

Write-Host " – Server [$($mfSrv.ServerName)] is set to [$($mfSrv.WinServerObject.EnableLogon)] for EnableLogon"

Write-Host

Another option would be to remove the Apps from the Server all together.

# Unpublish-CitrixServer.ps1
# Brandon Shell [MVP]
# www.bsonposh.com
# Removes all App from Server
Param($Server)
$mfsrv = New-Object -ComObject MetaFrameCOM.MetaFrameServer
$mfsrv.Initialize(6,$Server.ToUpper())
$mfsrv | foreach{$_.Applications} | foreach{$_.LoadData(1);$_.RemoveServer($Server.ToUpper());$_.SaveData()}

Get-CitrixAppServer.ps1 (Citrix Top 10)

This is pretty simple script. It is actually just an adaption from my Get-CitrixApplication.ps1 script posted at the bottom. There is a moment in time when you start thinking in terms of objects and stop thinking in terms of text output you are looking for.

This will make a huge difference in productivity and take you from constantly writing scripts to interactively getting the information you are after, but until you make the transition I will continue to provide scripts that do both 🙂

# Get-CitrixAppServer.ps1
# Brandon Shell [MVP]
# www.bsonposh.com
# Gets All the Servers for Specific App
Param($app)
$mfApp = New-Object -ComObject MetaFrameCOM.MetaFrameApplication
$mfApp.Initialize(3,$app)
$mfApp.LoadData(1)
$mfApp.Servers | %{$_.ServerName}

Here is the script that I use to return an Application object.

# Get-CitrixApplication.ps1
# Brandon Shell [MVP]
# www.bsonposh.com
# Gets a Citrix Application Object.
Param($app)
$mfApp = New-Object -ComObject MetaFrameCOM.MetaFrameApplication
$mfApp.Initialize(3,$app)
$mfApp.LoadData(1)
$mfApp

Then from the commandline I would just do this
PS> Get-CitrixApplication.ps1 “Applications\MyApp1” | %{$_.Servers} | %{$_.ServerName}

While this looks more complicated it is more versatile and easy to change. Lets say I want current User for this app instead.
PS> Get-CitrixApplication.ps1 “Applications\MyApp1” | %{$_.Sessions} | %{$_.UserName}

Find-CitrixUser.ps1 (Citrix Top 10)

This is another script that I can use quite often. It is a simple script that queries all the sessions and returns the ones where the User matches. I made the User a RegEx search so you could do multiple users.

Name: Find-CitrixUser.ps1
Purpose: Finds where the user(s) are and outputs session info

# Find-CitrixUser.ps1
# Brandon Shell [MVP]
# www.bsonposh.com
# Finds where the user(s) are and out puts session info
Param($user=".*",[switch]$help)
function HelpMe{
    Write-Host
    Write-Host " Find-CitrixUser.ps1:" -fore Green
    Write-Host "   Finds where the user(s) are and out puts session info"
    Write-Host
    Write-Host " Parameters:" -fore Green
    Write-Host "   -User                  : Optional. Name of the User or RegEx (Default is all users)"
    Write-Host "   -Help                  : Optional. Displays This"
    Write-Host
    Write-Host " Examples:" -fore Green
    Write-Host "   Finds User TestMe and outputs and returns ServerName,ClientAddress, and SessionID" -fore White
    Write-Host "     .\Find-CitrixUser.ps1 | ft ServerName,ClientAddress,SessionID " -fore Yellow
    Write-Host
    Write-Host "   Finds all Users who start with ‘Sales’ and returns UserName,ServerName, and SessionID"  -fore White
    Write-Host "     .\Find-CitrixUser.ps1 `"^sales`" | ft UserName,ServerName,SessionID " -fore Yellow
    Write-Host
    Write-Host "   To View All properties availiable." -fore White
    Write-Host "     .\Find-CitrixUser.ps1 <username> | Get-Member" -fore Yellow
    Write-Host
}

# Check for the Help or if
if($help){helpme;Write-Host;return}

# Code to Get the Farm and Initialize
$farm = New-Object -com "MetaframeCOM.MetaFrameFarm"
$farm.Initialize(1)

# Get the Sessions and Parse for Users who match
$farm.Sessions | ?{$_.UserName -match $user}

Get-CitrixPrinterInfo.ps1 (Citrix Top 10)

This script just collects the Printer Information from all the Servers in the Farm. It will output them to a file or you can pipe them and filter them.

Name: Get-CitrixPrinterInfo.ps1
Purpose: Gets Print Driver Info from all the Servers in the Farm and outputs to file or console

# Get-CitrixPrinterInfo.ps1
# Brandon Shell [MVP]
# www.bsonposh.com
# Gets Print Driver Info from all the Servers in the Farm
Param($Server,$file,[Switch]$help)
function HelpMe{
    Write-Host
    Write-Host " Get-CitrixPrinterInfo.ps1:" -fore Green
    Write-Host "   Gets Print Driver Info from all the Servers in the Farm"
    Write-Host
    Write-Host " Parameters:" -fore Green
    Write-Host "   -Server                : Optional. Server to Get Print Info From "
    Write-Host "   -File                  : Optional. File Name to Export Info to"
    Write-Host "   -Help                  : Optional. Displays This"
    Write-Host
    Write-Host " Examples:" -fore Green
    Write-Host "   Gets Print Info and Exports to File" -fore White
    Write-Host "     .\Get-CitrixPrinterInfo.ps1 -file MyExportFile.txt" -fore Yellow
    Write-Host
    Write-Host "   Gets Print Drivers from a Specific Server and outputs DriverName and SourceServer"  -fore White
    Write-Host "     .\Get-CitrixPrinterInfo.ps1 <serverName> | ft DriverName,SourceServer" -fore Yellow
    Write-Host
}

# Check for Help Flag
if($help){HelpMe;Write-Host;Return}

# Check for File
if($file)
{
    if($server) # If -Server was passed we run check just against it and output to screen
    {
        $mfsrv = new-Object -com "MetaframeCOM.MetaframeServer"
        $mfsrv.Initialize(6,$Server.ToUpper())
        $mfsrv | foreach{"`n$($_.ServerName) `n$(‘-‘*20)";$_.PrinterDrivers| Format-Table} | out-File $file -enc ASCII
    }
    else # We run the check against the whole farm and output results to file
    {
        $mfarm = new-Object -com "MetaframeCOM.MetaframeFarm"
        $mfarm.Initialize(1)
        $mfarm.Servers | foreach{"`n$($_.ServerName) `n$(‘-‘*20)";$_.PrinterDrivers| Format-Table} | out-File $file -enc ASCII
    }
}
else
{
    if($server) # If -Server was passed we run check just against it and output to screen
    {
        $mfsrv = new-Object -com "MetaframeCOM.MetaframeServer"
        $mfsrv.Initialize(6,$Server.ToUpper())
        $mfsrv | foreach{"`n$($_.ServerName) `n$(‘-‘*20)";$_.PrinterDrivers| Format-Table}
    }
    else # We run the check against the whole farm and output results to screen
    {
        $mfarm = new-Object -com "MetaframeCOM.MetaframeFarm"
        $mfarm.Initialize(1)
        $mfarm.Servers | foreach{"`n$($_.ServerName) `n$(‘-‘*20)";$_.PrinterDrivers| Format-Table}
    }
 }

Next »