Waclaw Chrabaszcz
... there is no spoon ...

Easter egg – OMG^2 the true PowerShell in bash window

Let's continue this crazy experiment. More or less it should works on any distro in my case it is Ubuntu 13.

The idea is to use wine (Wine Is Not an Emulator J) to install Powershell 2.0 for Windows XP. Wine can emulate W7 or W8 however it refuses to install .MSU packages. To reach our goal we will need to use experimental wine 1.7 or above and EXE file so …

For the science!!!

sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine1.7 winetricks
wget http://kegel.com/wine/winetricks
bash winetricks -q msxml3 dotnet35sp1
bash winetricks lucida
taskset -c 0 bash winetricks windowscodecs
wget -O ~/.cache/winetricks/WindowsXP-KB968930-x86-ENG/WindowsXP-KB968930-x86-ENG.exe http://download.microsoft.com/download/E/C/E/ECE99583-2003-455D-B681-68DB610B44A4/WindowsXP-KB968930-x86-ENG.exe
cd '~/.cache/winetricks/WindowsXP-KB968930-x86-ENG'
wine ./WindowsXP-KB968930-x86-ENG.exe


wine powershell

Happy Easter!



How to install XenApp 7.5

Ha!Ha! XenApp is back! ... Not exactly ... For me XenApp that's IMA architecture, here we have XenDesktop's FMA. Is it better, that's very good question. For me it is just different. Of course I like Broker-Agent concept, but where's my QFARM command? Based of rumors, not confirmed so far by myself, sessions prelaunching, support for retired Citrix streaming and of course Web Interface is back. Let's check it. Hmm .. Looking into official documentation it is not so sweet, sessions prelaunching for sure has been removed.

http://support.citrix.com/proddocs/topic/xenapp-xendesktop-75/cds-overview-features-not-in-this-release.html

 

To install Delivery Controller execute:

ServerManagerCMD -Install NET-Framework-Core
"D:\x64\XenDesktop Setup\XenDesktopServerSetup.exe" /xenapp /noreboot /quiet /configure_firewall /components CONTROLLER,DESKTOPSTUDIO,DESKTOPDIRECTOR,LICENSESERVER

 

To install a worker:

ServerManagerCMD -Install NET-Framework-Core
"D:\x64\XenDesktop Setup\XenDesktopVDAsetup.exe" /quiet /components VDA,PLUGINS /controllers XenApp75-1.testdomain.net /enable_remote_assistance /ENABLE_REAL_TIME_TRANSPORT /enable_hdx_ports /nodesktopexperience

 

After XenDesktop's style Site deployment everything is set and ready … but http://www.youtube.com/watch?v=DkDSP7sdLG8

I'll stay with the true name and features of this product, it is called XenDesktop 7.5, and I really like it …. btw if you agree with me just remove /xenapp from the command line J

 



SCOM 2012 R2 – How to put servers into Maintenece mode using PowerShell

In more or less ITIL's world you have to monitor availability and performance of your servers. However from time to time you need to apply approved changes, what means temporary unavailability or performance degradation. When we talk about Worldwide organizations, in many cases it is really hard to inform everyone about upcoming changes. Sometimes you don't want to inform anyone, you just don't want to wake up your colleagues at 2:00 AM their local time. So to apply the change in elegant way let's put affected boxes into maintenance mode, SCOM won't bother anyone with fake alarms. To not spend all day on SCOM console, let's use PowerShell for this task.

Import-Module -name OperationsManager
$servers = (`
'dc.TESTDOMAIN.net',`
'SQL-1.testdomain.NET'`
)

$Time = ((Get-Date).AddMinutes(30))
$comment = "Change-997: Applying MS hotfixes"
$reason = "ApplicationInstallation"
<# -Reason Valid values are: PlannedOther,
UnplannedOther, PlannedHardwareMaintenance, UnplannedHardwareMaintenance, PlannedHardwareInstallation,
UnplannedHardwareInstallation, PlannedOperatingSystemReconfiguration, UnplannedOperatingSystemReconfiguration,
PlannedApplicationMaintenance, ApplicationInstallation, ApplicationUnresponsive, ApplicationUnstable,
SecurityIssue, LossOfNetworkConnectivity.
#>
foreach ($server in $servers)
{
$Instance = Get-SCOMClassInstance -Name $server.ToUpper()
Write-Host $Instance
Start-SCOMMaintenanceMode -Instance $Instance -EndTime $Time -Reason $reason -Comment $comment
}

If you'll have problem with comma formatting try this way:

$servers = ('dc.TESTDOMAIN.net','SQL-1.testdomain.NET')



Windows 8.1 – God bless the miracast

As happy owner of the most sexy ultrabook Samsung NX900 i5 - I always wanted to use my TV as secondary wireless monitor. Why? Number one: for watching movies, number two: as additional display when I work from home. Today's post will be much more related to the lifestyle, than IT technology. However this setup gave me much more excitement than deployment of hundreds stateless VDIs.

Many people still asks themselves: "why should I migrate into Windows 8.1". In my case the answer is Hyper-V and Miracast. Hyper-V because it is easy, free, and efficient hypervisor. Of course if someone love VMware Player or VirtualBox he can stay with it. But personally, I shy a bit, that … as declared and certified Microsoft engineer I know WMware PowerCLI better than Hyper-V PowerShell commandlets . So, good bye Hyper-V GUI, since now everything what I do will be implemented via PowerShell.

But … let's stick to the point.

Consider this post as usecase, not the endorsement of anything in particular. So, we've got i5 Samsung NX900 laptop with Intel 3000 GPU, declared by manufacturer WIDI support and brand new Samsung F6640 TV set.

A little background

WIFI direct - it is a very young streaming standard, your TV set have to support it, otherwise you will need to buy any WIDI or Miracast receiver

Miracast – it is a streaming technology originally designed for Android devices, and in my opinion, it is one step from becoming global standard. If I understood correctly what I read, WIFI direct covers/includes Miracast

Intel WIDI - it is an old PC streaming technology, based on Intel GPU, NIC, and Audio components – your laptop must support it. Since version 3.5 Intel WIDI supports/emulates Miracast streaming.

Windows 8.1 brings out of box support for Miracast

After few failed tries on Windows 7 I decided to upgrade my laptop to 8.1, including the installation of all hotfixes and drivers. During long hours of tests I found that for WIDI it is very important to have PROPER graphics driver, WIDI version, (WTF !!!) Network adapter driver and Audio device driver. The easiest way to reach it is to install Intel WIDI update tool: http://supportkb.intel.com/wireless/wireless-display/templates/selfservice/intelwidi/#portal/1026/article/16168 . It will download and install all required components for you. My current configuration:

Get-WmiObject -Class Win32_product|where { $_.Name -like "*Intel*"} | Format-Table Name,Version

Name Version
---- -------
Intel(R) WiDi 4.3.3.0
System Requirements Lab for Intel 4.5.22.0
Intel(R) PRO/Wireless Driver 16.07.0000.0730
Intel(R) PROSet/Wireless Software for Bluetooth(R) Technology 2.6.1209.0268
Intel® PROSet/Wireless WiFi Software 16.7.0.0297
Intel(R) Update Manager 1.6.0.56
Intel® Trusted Connect Service Client 1.24.388.1

My apologies, but I'm not going to break original PowerShell formatting. Once you install all required drivers, reboot your laptop and in the meantime make sure that you have the most recent firmware installed on your TV. Don't forget to connect your TV to your home network. Windows 8.1 should install couple of hotfixes, and after the reboot you'll be able to discover your TV set in WIDI software as well as device in your Settings | Change PC settings.

I noticed about 1 second delay on streamed screen, so for gaming you'll still need to relay on HDMI cable, in any other scenarios it works perfect.

Maybe my method is not efficient but for sure it works …



Active Directory – How to promote Server 2012 R2 to DC and even more using PowerShell magic

It will be quick post, I have limited access to the Internet.

Today we are going to promote Windows 2012 to Domain controller and move some unique roles to it. It can be handy in DR scenario, or when we are going to raise domain functional level. It is very easy task, so to make some fun I'm not going to touch a GUI.

Prepare AD forest for Server 2012 if it is needed. Of course as a Schema Admin, of course it is one way ticket, so think twice before you do anything.
Don't forget about backing up your AD. It is recommended to execute it on the Schema Master server

{your Server 2012 R2 cd installation media}\support\adprep\adprep /forestprep

If you are sure that you are sure type c and hit Enter

After that we can switch to our destination Server 2012 R2,

Add-WindowsFeature AD-Domain-Services
Import-Module ADDSDeployment
$pwd = convertto-securestring "P@ssW0rD!" -asplaintext –force
Install-ADDSDomainController –DomainName "testdomain.net" –SaveModeAdministratorPassword $pwd –Force

Optionally after the reboot

Move-ADDirectoryServerOperationMasterRole –Identity DC2012 -OperationMasterRole PDCEmulator,SchemaMaster,DomainNamingMaster,InfrastructureMaster,RIDmaster –Force –Confirm:$false

Where DC2012 is a hostname of the new domain controller



OMG!!! A PowerSHELL within the bash console!

Each year during last days of the calendar year most of corporations enters into change freeze mode. During these days IT pros have to do … nothing J ! This is an example, how these stories usually ends ..

I don't like to wear a hat, especially red, so my favorite penguin is named Ubuntu. I found nice .DEB package named winexe

http://download.opensuse.org/repositories/home:/ahajda:/winexe/xUbuntu_12.10/i386/

After the installation we have access to new command, let's test how it works in "practice"

Winexe –interactive=1 –user testdomain/Administrator –password Password1 //scom.testdomain.net cmd.exe
powershell get-service –displayname System*

At this point of time I cannot execute PowerShell directly, perhaps I will need to lower security settings on the Windows box, I have few days to play cats and mice game with it ..

Yes I know it not make any sense. But it is sexy, isn't it?

Happy and silent Christmas with best friends and families! Let be a peace between Linux&Windows, XenDesktop&VMwareView, Hyper-V&ESXi, EMC&NetApp, PowerShell&bash, ASP.NET&PHP … My best wishes to every of You! Let the New Year bring us new challenges, opportunities and a lot of luck in professional and personal lives!



SCCM2012 R2 – How to schedule collection refresh interval using PowerShell

There was an open subject after my first post about scripting ConfigMgr. In the meantime I've migrated from SCCM 2012 SP1 to R2, so I am really not sure whether this commandlet works for legacy versions. Here's the good example how to use schedule token while you are creating a device collection.

 

$schedule = New-CMSchedule –RecurInterval Days –RecurCount 1
New-CMDeviceCollection -Name testDevCol -LimitToCollectionName "All systems" –RefreshSchedule $Schedule
Add-CMDeviceCollectionQueryMembershipRule -CollectionName "testDevCol" -QueryExpression "select * from SMS_R_System inner join
SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Name
like ""WKS-_______""" -RuleName "testRule"

There are various ways how you can define your schedule, of course, based on your needs

SYNTAX

New-CMSchedule [-IsUtc] [-ScheduleString] [-Start <DateTime>] -Nonrecurring [<CommonParameters>]

New-CMSchedule [-IsUtc] [-RecurCount <Int32>] [-ScheduleString] [-Start <DateTime>] -DayOfMonth <Int32> -End <DateTime> [<CommonParameters>]

New-CMSchedule [-IsUtc] [-RecurCount <Int32>] [-ScheduleString] [-Start <DateTime>] -DayOfMonth <Int32> [<CommonParameters>]

New-CMSchedule [-IsUtc] [-RecurCount <Int32>] [-ScheduleString] [-Start <DateTime>] -DayOfMonth <Int32> -DurationCount <Int32> -DurationInterval <ScheduleInterval> [<CommonParameters>]

New-CMSchedule [-IsUtc] [-RecurCount <Int32>] [-ScheduleString] [-Start <DateTime>] -DayOfWeek {Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday} [<CommonParameters>]

New-CMSchedule [-IsUtc] [-RecurCount <Int32>] [-ScheduleString] [-Start <DateTime>] -DayOfWeek {Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday} -DurationCount <Int32> -DurationInterval <ScheduleInterval>-WeekOrder <ScheduleWeekOrder> [<CommonParameters>]

New-CMSchedule [-IsUtc] [-RecurCount <Int32>] [-ScheduleString] [-Start <DateTime>] -DayOfWeek {Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday} -DurationCount <Int32> -DurationInterval <ScheduleInterval> [<CommonParameters>]

New-CMSchedule [-IsUtc] [-RecurCount <Int32>] [-ScheduleString] [-Start <DateTime>] -DayOfWeek {Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday} -WeekOrder <ScheduleWeekOrder> [<CommonParameters>]

New-CMSchedule [-IsUtc] [-RecurCount <Int32>] [-ScheduleString] [-Start <DateTime>] -DayOfWeek {Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday} -End <DateTime> [<CommonParameters>]

New-CMSchedule [-IsUtc] [-RecurCount <Int32>] [-ScheduleString] [-Start <DateTime>] -DayOfWeek {Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday} -End <DateTime> -WeekOrder <ScheduleWeekOrder> [<CommonParameters>]

New-CMSchedule [-IsUtc] [-RecurCount <Int32>] [-ScheduleString] [-Start <DateTime>] -DurationCount <Int32> -DurationInterval <ScheduleInterval> -LastDayOfMonth [<CommonParameters>]

New-CMSchedule [-IsUtc] [-ScheduleString] [-Start <DateTime>] -DurationCount <Int32> -DurationInterval <ScheduleInterval> -RecurCount <Int32> -RecurInterval <ScheduleInterval> [<CommonParameters>]

New-CMSchedule [-IsUtc] [-ScheduleString] [-Start <DateTime>] -DurationCount <Int32> -DurationInterval <ScheduleInterval> -Nonrecurring [<CommonParameters>]

New-CMSchedule [-IsUtc] [-ScheduleString] [-Start <DateTime>] -End <DateTime> -Nonrecurring [<CommonParameters>]

New-CMSchedule [-IsUtc] [-RecurCount <Int32>] [-ScheduleString] [-Start <DateTime>] -End <DateTime> -LastDayOfMonth [<CommonParameters>]

New-CMSchedule [-IsUtc] [-ScheduleString] [-Start <DateTime>] -End <DateTime> -RecurCount <Int32> -RecurInterval <ScheduleInterval> [<CommonParameters>]

New-CMSchedule [-IsUtc] [-RecurCount <Int32>] [-ScheduleString] [-Start <DateTime>] –LastDayOfMonth [<CommonParameters>]

New-CMSchedule [-IsUtc] [-ScheduleString] [-Start <DateTime>] -RecurCount <Int32> -RecurInterval <ScheduleInterval> [<CommonParameters>]



SCCM2012 R2 – How to integrate MDT with SCCM

There are two maybe not competitive but parallel products: Microsoft Deployment Toolkit and System Center Configuration manager. Few years ago I was wondering why they are separate, I why I cannot share Task Sequences between them. And how it usually happens in live, when I was focused on other technologies, MDT and SCCM became best friends.

Let's integrate MDT with SCCM:

  1. If first step you need to download MDT http://www.microsoft.com/en-us/download/details.aspx?id=25175
  2. Install MDT on your SCCM server box


    accept the EULA


    Join CEIP if you like

     

  3. Once you completed the installation I would recommend you to complete MDT configuring before integration with the SCCM. Start the Deployment Workbench


    install updates



    you will need to download and install WAIK








    create new deployment share









    leave default values


  4. Create MDT database





    Make sure you will create separate database, DO NOT use existing SCCM DB




  5. Now we are ready to integrate MDT with SCCM


    the Integration tool should discover your server automatically




    After reopening SCCM console in task sequences you should have new cool features:



    How to use them? That's another story …






     



App-V 5.0 and Citrix Integration Overview

http://download.microsoft.com/download/C/4/1/C416F9FD-1B51-4E1D-9DBE-87C12AB329A2/App-V5_and_Citrix_Integration_Overview.docx



How to obtain Visual Studio 2013 for offline installation

Sometimes you have to work in isolated environments, just to not affect production boxes by mistake. So, how can I install Visual Studio 2013 within IP island ?

Download vs_ultimate.exe from http://www.microsoft.com/visualstudio/eng/downloads

and execute it from CMD with parameter:

vs_ultimate.exe /layout C:\Install\VisualStudio