• PowerShell 3.0 – Shell from Future

    PowerShell 3.0 is shipped with Windows 8. We are still experiencing some of the great features of Windows Server 8, but PowerShell 3.0 also brings many new features. Thanks to PowerShell Product Team for such a great innovation.

    In this blog post, I will discuss about some of simplified syntaxes.

    PowerShell Integrated Script Environment has an improved UI design and features.

    clip_image002

    This is new designed PowerShell ISE console.

    Right pane you’ll notice Commands section.

    clip_image004

    As you know, in PowerShell V2 you have to query available commands or syntax with get-help or Tab button.

    In PowerShell 3.0 you can search any kind of command within Commands pane. I searched for commands that includes “printer” and it outputs all available commands.

    And also it provides me all required or optional parameters for selected command.

    Now i can select Get-Printer cmdlet and fill up mandatory or optional params.

    clip_image006

    Now just click copy and paste into script pane.

    clip_image008

    This is a great feature especially for those who don’t like much writing or remembering script syntax.

    Another great feature is improved Tab button Smile Now it completes automatically for all kind of parameter, argument etc. within a window.

    In below example, I just write Get-Pro and press tab. It brings all available commands that start with Get-Pro

    clip_image010

    It also brings parameters and arguments.

    clip_image012

    And finally it gets to you all available processes on your system lively !

    clip_image013

    Another example of argument auto completion:

    clip_image014

    Auto completion also works for .Net. If you call [System.Net.DNS] it will bring you all available methods.

    clip_image016

    Error notification is also available lively.

    clip_image017

    I think one of the greatest features of PowerShell 3.0 is statement help.

    If you press CTRL + J, it will bring you all statements with their usage and examples.

    clip_image019

    But this is not enough.

    Just click one of the statements and then it will paste a template usage example into your Script Pane.

    clip_image020

    This is a great feature cause I believe many system administrators don’t want to remember usage of each statement. They don’t need any more.

    With PowerShell 3.0, you don’t need special $_. Character to filter script outputs.

    Below is a simple example in PowerShell 2.0 to get a process that has a name “IDLE”. For complex scripts it is open for mistakes.

    clip_image021

    In PowerShell 3.0 just put a pipe and write only column name with no special character. It works and looks great.

    clip_image022

    It’s same for foreach too.

    clip_image023

    This is a brief post about PowerShell 3.0 features. There are bunch of great features and we will figure out them in our next blogs.

  • Installing and Configuring target iSCSI server on Windows Server 2012 “Server 8 Beta”

    iSCSI Software Target is now part of windows Server 8 Beta Roles and features, In this post i will walkthrough installing and configuring iSCSI software target.

    Important Notes:

    - iSCSI Target server now is integrated with Windows Failover clustering to provide HA for iSCSI target server, however in this post we will be  configuring a stand-alone iSCSI target server.

    - Windows PowerShell can be used to install and configure iSCSI target server.

    Environment details:

    - Single iSCSI server IP address: 192.168.0.217

    - File server “ServerA” IP address: 192.168.0.215

    - File server “ServerB” IP address: 192.168.0.216

    1. To install Windows server 8 iSCSI target open Server Manager and click Add Roles and Features then walkthrough the installation as per the below screenshots

    clip_image002

    clip_image004

    clip_image006

    clip_image008

    clip_image010

    clip_image012

    clip_image014

     

    clip_image016

    clip_image018

    2. After installation is complete successfully we will now configure the iSCSI target server as per the following

    - We will have single VHD of 5 VHDs

    - Access is allowed to two file server nodes

                o 192.168.0.215

                o 192.168.0.216

    - Storage target name is File Server

    To complete iSCSI target server the configuration go to Server Manager , click File and Storage Services then follow the screenshots below;

    clip_image020

    Go to iSCSI Virtual disks and click “Launch the New Virtual Disk wizard to create a virtual disk” and walk through the Virtual Disks and targets creation

    clip_image022

    clip_image024

    clip_image026

    clip_image028

    clip_image030

    clip_image032

    clip_image034

    clip_image036

    clip_image038

    clip_image040

    clip_image042

    clip_image044

    clip_image046

    3. To connect File Server nodes to iSCSI target open Server Manager click Tools and select iSCSI Initiator then proceed with the configuration as per the below screenshots

    clip_image002[4]

    clip_image004[4]

    clip_image006[4]

    Now we open disk management to make sure that the disk is presented correctly

    clip_image008[4]

    Repeat step 3 for the second file server node.

  • Windows Server 2012 “Server 8 Beta” GUI Removal and Reinstallation

    One of the very interesting features of Windows Server 8 Beta is the ability to install your server with full GUI and do all of your required configurations and then remove the GUI to be server core. Same operation can be done the other way around as some people may install server core and realize that having a GUI will give them the ability to do tasks they are used to quicker then remove the GUI after.

    In the post we will see the complete procedures to take Windows Server 8 Beta with GUI to server core and vice versa.

    1. First step will be installing with Server 8 Beta with full GUI by selecting “Windows Server 8 Beta Datacenter (Server with a GUI)

    clip_image002

    2. After installation login to Windows Server normally and do all of the required configuration on this server, when done in Server Manager click Manage then Remove Roles and Features.

    clip_image004

    3. In the Before you begin page click next.

    clip_image006

    4. On Server Selection page select the server you want to perform this operation on, in our case it’s the local server.

    clip_image008

    5. Skip Remove Server Roles page by clicking next

    clip_image010

    6. On the Remove Features page uncheck User interfaces and Infrastructure

    clip_image012clip_image014

    7. Confirm your removal selection and restart the server manually if you didn’t select “Restart the destination server automatically if required”

    clip_image016clip_image018

    8. Now the server has no GUI and when you login to the server after restart you will be prompted with CMD

    clip_image020

    9. To reinstall the GUI again type PowerShell in the CMD screen, then type

    Add-WindowsFeature Server-GUI-Shell

    clip_image022

    10. Wait for the installation to complete and then restart your server by typing Shutdown –r –t 0

    Server8-GUI-0017

    clip_image024

  • Waiting Tasks Caused by FSAGENT in SQL Server 2008

     

    After preparing a brand-new server hosting SQL server 2008 and before starting anything ,we’ve noticed that there are 5 waiting tasks on server,it was really weird as no users are connected and no operation took place yet! The activity monitor displayed 4/5 waiting tasks as follows:

    clip_image002

    After the investigation and running couple of scripts for troubleshooting we reached to root cause of the issue ,By running the following script that lists the waiting tasks on server , it shows that FSAGENT has 5 waiting tasks :

    SELECT * FROM sys.dm_os_waiting_tasks

    SELECT CAST(wait_type AS VARCHAR(30)) AS 'Waiting task', COUNT (*) AS 'Number of waiting tasks'

    FROM sys.dm_os_waiting_tasks

    GROUP BY wait_type

    ORDER BY 'Number of waiting tasks' DESC;

    Go

    clip_image004

    FSAGENT is part of the FILESTREAM subsystem, FILESTREAM is a new feature introduced in SQL Server 2008 which provides an efficient storage and management option for BLOB data.

    This wait type occurs when a FILESTREAM file I/O operation is waiting for a FILESTREAM agent resource that is being used by another file I/O operation, in our case this feature is not needed so as a quick solution we’ve just disabled file stream access level feature from server properties as follows:

    clip_image006

    And after this feature is disabled the waiting tasks on activity monitor shows 0 waiting tasks!

    clip_image008

    Now the question is, why there are 5 waiting tasks before disabling this feature?, well it seems that this is a known bug that's been fixed in KB 958942 titled FIX: Activity Monitor shows the high wait times when the FSAGENT wait type is enabled on a server that is running SQL Server 2008.

  • System Center 2012 Orchestrator–RunBook Basics

    Part 2: http://blogs.technet.com/b/meamcs/archive/2012/03/09/system-center-2012-orchestrator-runbook-activities.aspx

    Part 3: http://blogs.technet.com/b/meamcs/archive/2012/03/14/system-center-orchestrator-2012-test-amp-start-runbooks.aspx

    Part 4: http://blogs.technet.com/b/meamcs/archive/2012/04/09/system-center-2012-orchestrator-link-conditions.aspx

    System Center Orchestrator 2012 which is a new member of System Center 2012 family and next version of Opalis, takes place at the center of Private Cloud scenarios. During automation of your dynamic datacenters, Orchestrator can move your operations one more step forward and can integrate with Microsoft and non-Microsoft solutions with just a few clicks.

    Let me give you a few examples;

    • You can trigger Orchestrator workflows through an incident management system such as Service Manager 2012.
    • Periodic installation processes can be automated. For example during installation you can take actions on active directory, stop load balancer pools, check service status etc.
    • Active directory operational tasks such as user create, user delete, group create, change memberships etc. can be moved to the orchestrator RunBooks.
    • You can monitor SCOM alerts and trigger custom RunBooks. For example when a virtual machine run out of disk, SCOM generates an alert and orchestrator can assign additional disk through triggered RunBook.

    In this blog post series we’ll cover of how to design RunBooks from basic to complex. And at end of the series you will understand what Orchestrator 2012 can do and how can you integrate it into your current environment.

    For the first part “RunBook Basics” I’ll mention basic RunBooks concept and activities that resides within RunBooks.

    A RunBook consists of automated tasks and process steps. Also each automated step within RunBooks is called activities.

    Here is the very basic RunBook design;

    clip_image001[4]

    That RunBook reads a static text file and maps each line to the server names then restarts a service for each remote server automatically.

    Before going into the RunBook creation details, let’s look at the RunBook properties.

    clip_image002[4]

    Right click a previously created RunBook and click Properties.

    GENERAL:

    clip_image003[4]

    On the General tab, you can customize name and description fields. Name is an important field because if you decide to import your RunBooks into the Service Manager as activities, you will recognize each RunBook with its name. (Yes you can import your RunBooks into the Service Manager!)

    Also on general tab, you can set a schedule to allow RunBook runs only on dates and times you specify.

    RUNBOOK SERVERS:

    clip_image004[4]

    Each RunBook needs a RunBook server to run. In case of requirement High Availability , you must add additional RunBook Servers. For each RunBook, primary and standby RunBook Servers can be set.

    Failure of primary RunBook server will trigger standby RunBook server to act as primary.

    clip_image005[4]

    To set Primary and Standby RunBook Server for RunBooks, click Add and specify your RunBook servers.

    LOGGING:

    In this section you can choose more logging options to store in Orchestrator Database and show up within Orchestrator Console.

    I’ll talk about in more details in future posts.

    clip_image006[4]

    EVENT NOTIFICATION

    clip_image007[4]

    On event notification tab, additional log file can be generated when a RunBook fails to run or run for more than specified seconds. Related log files can be viewed with Designer Console or Web Console.

    JOB CONCURRENCY

    clip_image008[5]

    One of the most critical option is Job Concurrency. Even you configure this setting for one single RunBook, in fact it has impact on overall Orchestrator RunBook Servers. Main purpose is specifying concurrent jobs for this RunBook. A RunBook server can have maximum 50 concurrent jobs. So that if you need more than this limit you must deploy additional RunBook servers.

    RETURNED DATA

    clip_image009[4]

    If you finalize your activities with “Return Data” activity, this RunBook can carry out defined data to the other RunBooks.

    clip_image010[4]

    In this blog post we cover basic RunBook concept. For the next parts we’ll drive in more detail about designing and deploying RunBooks over multiple RunBook servers.