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

PowerShell

Windows 10 – How to set default transparency of CMD and PowerShell windows

Transparency always looks cool. Since I noticed that everytime when I launch CMD or PoSH console I have to 3-4 times use "SHIFT CTRL – " combination time to change the default behavior. Windows Registry Editor Version 5.00[HKEY_CURRENT_USER\Cons... [HKEY_CURRENT_USER\Console\... ......

PowerShell & ActiveDirectory - BYOTD - Build your own test domain

Sometimes you'd like to test your scripts/polices/solution before the implementation against thousands of users. And as usuall, your personal LAB is too poor, on the other side your Admin considers OU creation in crime categories. I love these stories … "I won't create this GPO until you show me that it works. " I would say a typical IT paradox. Psssst… the beer is open. Let's create some better OU structure on my LAB domain. Cheers! If you wondering how to build a domain and DC, I'd recommend you ......

Hyper-V & PowerShell – How to create a VM with a differential disk

How many times you have to create a VM to test something? How many times you have to watch OS installation progress. Enough! All you need is to create a differential disk to your golden image and spin it. There is another advantage of differential disk. You can create a pseudo strip and keep master image on one drive (SSD) and differential disks on other hard drives. I like this setup for my R&D games. It saves a lot of storage and improves VMs performance. Ad of course I can repeat something ......

Server 2012 and PowerShell remoting – How to create a failover cluster without leaving your desk(top)

Who's the king? Of course PowerShell. Let's try to use its beauty to create 3 node failover cluster. It's nothing unusual, where is this beauty? In remoting of PowerShell scripts. RDP is for noobs. Geeks(withBlogs) do such tasks this way: # Install Failover Clustering and File Server RolesInvoke-Command -ComputerName Server1, Server2, Server3 -ScriptBlock {Get-WindowsFeature *Cluster* | Add-WindowsFeature –includeManagementToolsGet-... *File-Services* | Add-WindowsFeature –includeManagementToolsGet-... ......

Server 2012 R2 – Storage Spaces – A Software Defined Storage by Microsoft

You know ... when I was young (bear in mountainsJ) the server was meaning a file server and Novell as well. In 2000 Microsoft released Server 2000, Active Directory and have changed the world once forever. We will never forget year 2002 when Windows XP was born and of course Server 2003. It was great time to participate in this revolution. We were so proud doing migrations to XP/2003 world. Once it was done we choose to rest, not we … Microsoft did it. It's funny but what you should be aware in live ......

PowerShell – Sexy PoSH console

PowerShell don't has to be boring. Download this module: http://www.powertheshell.co... Extract it into C:\Windows\System32\Windows... may need to enable both module files by right clicking | Prosperities |Unlock) Now you can start PowerShell window: Import-Module PTSAeroConsoleEnable-AeroGl... Enjoy ......

XenDesktop 7 – The QFARM /LOAD case

For XenApp admin live without QFARM is like live without right hand. Of course you can obtain required information using the PowerShell, but XenDesktop 7's command line is too long to remember and type. Let's make some sweet alias. Add-PSSnapin citrix.*set-alias qfarm Qfarm-Loadfunction Qfarm-Load {Get-BrokerMachine -SessionSupport MultiSession -Property dnsName,loadIndex,SessionCo... Of course you'll need to update your personal ENV to start this alias automatically ......

AZURE - Stairway To Heaven

Before you’ll start reading please start to play this song. OK boys and girls, time get familiar with clouds. Time to become a meteorologist. To be honest I don’t know how to start. Is cloud better or worse than on campus resources … hmm … it is just different. I think for successful adoption in cloud world IT Dinosaurs need to forget some “Private Cloud” virtualization bad habits, and learn new way of thinking. Take a look: - I don’t need any tapes or CDs (Physical Kingdom of Windows XP and 2000) ......

PowerShell – duplicated files in Windows Media Player library

Holiday! .. But why it's raining. Let's cleanup some duplicated MP3s. Maybe the rain will stop in the meantime. For sure this code is not optimized, and I am not recommending anyone to use it. If you uncomment move actions you can reduce number of duplicated media files in your Windows Media Player library. You can consider it as an example how to access and browse WMP using PowerShell. $wmp = New-object –COM WMPlayer.OCX$playlist = $wmp.mediaCollection.getAll... { if ($playlist.item($i).sourceURL ......

Server 2012 GUI – to be or not to be …

That's the question J This quick post is inspired by one of feedbacks. To enter into PowerShell just type powershell in CMD To make Server 2012 core server: PowershellUninstall-Windows... Server-Gui-Shell, Server-Gui-Mgmt-InfraShutdown –r To restore server's GUI PowershellInstall-WindowsFe... Server-Gui-Shell, Server-Gui-Mgmt-InfraShutdown –r Voila ! P.S. Of course it not works for 2008 ......

Server 2012R2 – PowerShell Web Access

Haha … Sometimes I'm joking that there is nothing worse than Linux fanboi imprisoned in Windows engineer's body. Maybe someday I will start blogging about my noob's experiences. However let's stick to the point. Sometimes the easiest solutions are the best. After couple of tries how to reach left pocket using right hand I'm going to follow easy path. Today's plan is very easy, I'm going to take advantage of Server 2012 and install Web gateway to PowerShell console. After that I would be able execute ......

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/ppasudo apt-get updatesudo apt-get install wine1.7 winetrickswget http://kegel.com/wine/winet... ......

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 ......

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 ......

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.or... After the installation we have access to new command, let's test how it works in "practice" ......

SCOM 2012 SP1 – XenApp monitoring

If you have to manage many XenApp farm, or just one but really big - it will be worth to have good robust tool for it. As a Citrix guy I should prefer EdgeSight, hopefully I am Microsoft victim and I am going choose SCOM. Why, because SCOM offers active monitoring, it is not only checking the health of my servers it can recover them in many situations. To start monitoring we have to: Deploy SCOM agents on Citrix boxes Mark them as a proxy to forward XenApp events (in my opinion SCOM run as account ......

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 1New-CMDeviceCollection -Name testDevCol -LimitToCollectionName "All systems" –RefreshSchedule $ScheduleAdd-CMDeviceCollec... ......

PowerShell – The first kiss with VMware PowerCLI

Long time ago VMware published they own PowerShell module. Let's take a look on it. First we need to download and install the module.https://my.vmware.co... It is a really simple Next, Next installation, and it creates a shortcut on your desktop. Here you have few simple examples. #add ESXi host$myServer="localhost"$M... = "192.168.1.10"$myLocation = "Cluster1"$MyUsername = "root"$MyPassword = "Password1"Add-VMHost -Server $myServer ......

How to install Windows Server features using PowerShell – Server 2012 R2 update

I have some feedback that list of roles and features is obsolete in my old post. Let's learn than how to have always up to date list. First things are first, to install some role or feature use followed command: Install-WindowsFeature -Name Web-Server -IncludeAllSubFeature Let's act as TRUE admin: $servers = ('server1', 'server2') foreach ($server in $servers) {Install-WindowsFeature –ConfigurationFilePath D:\ConfigurationFiles\ADCSC... -ComputerName $server} How to generate up to date ......

SCVMM – Round 2 – How to create a Private Cloud using PowerShell

Have you ever seen "A Bridge too far" movie? To not to wake up a click too far, it is good to script some tasks. Yes of course we can follow wizards, but some of us want to be warriorsJ. A small tip, take a look on credentials and system GUID examples. I don't know how about you, but for me it will be really useful in the future. # credents$credential = Get-CredentialNew-SCRunAsAc... -Name "TESTDOMAIN\Administrator" -Credential $credential #storage $opsMgrServerCredential = Get-SCRunAsAccount -Name ......

XenApp 6.5 – How to create and set a Policy using PowerShell

Here is my homework Add-PSSnapin -name Citrix.Common.* -ErrorAction SilentlyContinueNew-Item LocalFarmGpo:\User\MyPolicycd LocalFarmGpo:\User\MyPolicy... .\MinimumEncryptionLevel State EnabledSet-ItemProperty .\MinimumEncryptionLevel Value Bits128cd LocalFarmGpo:\User\MyPolicy... -Name "All Servers" -Value "All Servers"Set-ItemProperty LocalFarmGpo:\User\MyPolicy -Name Priority -Value 2 So cute … ......

A Windows 7 looking Terminal Server

Last time I posted as an old-school admin. You know what is wrong with old-schoolers ? Not old-schooled but rather outdated way of thinking. Many of us are still living in 80-thies and trying to develop Terminal Services environments in two colors and the highest possible compression level. What is another way of performance tuning? Let disable and remove everything, let will be nothing. Do you need a proof? Ask yourself did you remove the clock from the taskbar. If the answer is yes, you know what ......

SCCM 2012 SP1 – Welcome PowerShell on board!

I don't know how about you, but for me PowerShell is the only reason to migrate from SCCM 2007 to SCCM 2012. As an old-school SMS and SCCM admin I am not sure about user-centric distribution. Let's say straight. App-V and XenApp are much better in follow me apps, than classic MSIs. OK, let's stick the point. I have about 5 hours of experience with SCCM PowerShell module, and I can say there are pros and cons. What made me really sad: SCCM modules works only in x32 environment. It's a big mistake ......

XenApp -How to replicate printers using PowerShell

In XenApp 6.5 you have no GUI for printer replication. Add-PSSnapIn Citrix.*Get-XAPrinterDriver -Servername XAC-1Start-XAPrinterDriverR... -DriverName "Brother MFC-9970CDW Printer" -TargetServerName XAW-1 You can also autoreplicate printer: Start-XAAutoReplicatedPrint... –DriverName "Brother DCP-9055CDN Printer" You can copy the name of the printer by highlighting the name from the printer list and then paste it by right-clicking where it needs to be pasted ......

How to install Windows Server 2008/2012 roles/features using PowerShell

Let's make it faster … A simple PowerShell script Import-Module Servermanager Add-WindowsFeature Application-Server,Hyper-V,WAS -norestart And of course shutdown –r at the end List of roles and features: Role/Service or Main Feature R/S/F Name Installatiom command DHCP Server DHCP Server DHCP Print Services Print Server Print-Services Internet Printing Print-Internet LPD Service Print-LPD-Service Terminal Services Terminal Services Terminal-Services Terminal Server TS-Terminal-Server TS Licensing ......