Wednesday, July 24, 2013

Changing Desktop Wallpaper Positions using Powershell.

 

Hi,

Yesterday i blogged about changing Desktop background colour using Powershell.

Today we are going to change the Desktop Wallpaper Position using Powershell. Like the previous post this is again a registry tweak.

Windows Desktop wallpaper has 5 types of  Picture Position.

  1. Center
  2. Fill
  3. Fit
  4. Stretch
  5. Tile

The registry key which retains these settings is HKey_Current_User\Control Panel\Desktop and the registry key name is “WallpaperStyle”

 

Setting “WallpaperStyle” reg key value
Center 0
Fit 6
Fill 10
Stretch 2
Tile 0

Lets try it :)

24-07-2013 19-13-17

I have  centrally positioned wallpaper of my daughter “Manya”  and lets changed the position to FIT one.

Set-ItemProperty 'HKCU:\Control Panel\Desktop' -Name "WallpaperStyle" -Value 6

24-07-2013 19-15-09

now log off and log-in again.

and here you go , the “Picture Position” is set to “Fit.”

24-07-2013 19-16-54

Now lets set the wallpaper position to “Fill”

Here is our code, run it,

Set-ItemProperty 'HKCU:\Control Panel\Desktop' -Name "WallpaperStyle" -Value 10

24-07-2013 19-18-00

log-off and re login again. and our “Picture Position is set to fill :)

24-07-2013 19-18-49

Now, lets set it to the “Stretch”

run the code

Set-ItemProperty 'HKCU:\Control Panel\Desktop' -Name "WallpaperStyle" -Value 2

24-07-2013 19-19-46

log-off and re-login again , and the wallpaper is set to “Stretch” now.

24-07-2013 19-20-30

if you want to set wallpaper as TILE then we have to tweak two keys. the WallpaperStyle" and “TileWallpaper"

To tile the wallpaper, we need to set “TileWallpaper" to 1

run the script code.

Set-ItemProperty 'HKCU:\Control Panel\Desktop' -Name "WallpaperStyle" -Value 0

Set-ItemProperty 'HKCU:\Control Panel\Desktop' -Name "TileWallpaper" -Value 1

24-07-2013 19-23-24 

Log-off and log-in again.

and i can see my cute bunny’s picture all over the monitor.. :) . It successfully positioned as tile.

24-07-2013 19-24-45

Okies. now lets set every thing back to normal.

I am setting wallpaper as “cantered” positioned  and tile key to off.

Set-ItemProperty 'HKCU:\Control Panel\Desktop' -Name "WallpaperStyle" -Value 0

Set-ItemProperty 'HKCU:\Control Panel\Desktop' -Name "TileWallpaper" -Value 0

24-07-2013 19-25-30

log-off and log-in again.

and you can see, there is no tile and wallpaper is centrally positioned.

24-07-2013 19-27-09

I hope that you will find it handy and helpful.

Thanks
Aman Dhally
 
 
clip_image001 clip_image002 clip_image003 clip_image005clip_image007

Tuesday, July 23, 2013

Setting Desktop Background Colour Using Powershell.

 

Hi,

Sometime i write about doing some task with Powershell and that task are just a “Registry Tweaks”, and those tweaks can be done using some other methods too.

The idea behind with these post and scripts are, that when we are writing a powershell script, that will be completely powershell based.

For example if i creating an “Windows Customization ” tool and i need to configure few settings, then that tasks should be done by Powershell Not by something else.

“Task”

My today task was to set Desktop Background to be a specific colour.  First i was searching for how to do this using powershell and after a few minutes i have find that , that can be done by tweaking a registry key.

What we want to automate.?

we want to automate the below marked option “Change Background Colour”.

23-07-2013 19-53-16

What is current background colour.?

You can see in below picture that my current desktop background in “Dark Red”.

23-07-2013 19-57-55

Now lets Change the background to the “Green”.

The RGB Code for Green Colour is : 116 164 2

The Registry Key which holds the setting of background colour is “Background” located at “Hkey_Current_User\Control Panel\Colors”

Set-ItemProperty 'HKCU:\Control Panel\Colors' -Name Background -Value "116 164 2 "

Now run the above in Powershell console.

23-07-2013 20-05-39

Log off from your system and login again.

and here you go :)  after login back, we can see that our Desktop background colour is changed to the Green one :)

23-07-2013 20-08-28

Now, change the background colour of every laptop in your organization to  match with your company’s logos colour.

:)

I hope that you will find it helpful.

 

Thanks
Aman Dhally
 
 
clip_image001 clip_image002 clip_image003 clip_image005clip_image007

Friday, July 19, 2013

Set Internet Explorer Home Page using Powershell.

 

Hi,

Sometime in scripts or or in login scripts we want to set a users Internet Explorer home page to our Intranet site or to some other specific URL.

This became very handy and useful some times.

the code is below.

 

$myURL = "http://microsoft.com"
set-ItemProperty -Path 'HKCU:\Software\Microsoft\Internet Explorer\main' -Name "Start Page" -Value $myURL

In above code, we are setting a $myURL in to the registry key “HKCU:\Software\Microsoft\Internet Explorer\main”


Now lets test it.


 19-07-2013 20-45-26


i run the above code, and now my homepage should be set to “http://microsoft.com”


19-07-2013 20-46-47


wow!


Lets try one more, lets try to set google as a home page


19-07-2013 21-45-47


and let open the IE again.


Bingo ! working :)


19-07-2013 21-48-15


I hope you will like this little tweak.


and Happy weekend Guys :)


 




Thanks

Aman Dhally

 

 


clip_image001 clip_image002 clip_image003 clip_image005clip_image007

Tuesday, July 16, 2013

Powershell and Active Directory : Find empty Active Directory Groups using Powershell.

Hi Everyone.

Finally i come back to India and it is always love to be at home.

My today’s task was to create a list of all empty active directory groups, all groups those are not having any members.

As you know, i don’t like to do the manual tasks, so i decided to use powershell to accomplished this.

Lets do it.

Import Active Directory module.

Import-Module ActiveDirectory

12-07-2013 14-18-16

Once, Active Directory Module is loaded, run the below command.

 

Get-ADGroup -Filter * -Properties Members  | where { -not $_.Members} | select Name

Now , this will give you the list of all empty groups.

Now we have two groups “*ASKLAILA” and “*Hello Sir” as a result of the above command.

12-07-2013 13-56-01

Now lets cross-verified our result.

12-07-2013 13-57-05

12-07-2013 13-56-20

I hope you find this useful.

Thanks
Aman Dhally
 
 
clip_image001 clip_image002 clip_image003 clip_image005clip_image007

Wednesday, July 3, 2013

Powershell Script : Get the file and Product version of Ms office Applications.

Hi,

I hope you guys are doing good.

My last two months were very busy, that why i was not able to post any article. I apologize for that.
Last week Microsoft has release few mandatory ms office update.

That update was crucial for outlook users, before apply ms office updates, we need to know, which outlook version and build my users are using.

To achieve it, i have written a tiny “Powershell” script. when you run the script, that will give you the file version and product version information of WORD, EXCEL, POWERPOINT and outlook.

2

Download Link : http://gallery.technet.microsoft.com/scriptcenter/Get-Offie-Applications-5c0bb2e1

I tested this script on “office 2010 32 bit” on windows 7 32 bit.
I hope you may like the script and found it helpful.
Thanks
Aman Dhally
clip_image001 clip_image002 clip_image003 clip_image005clip_image007

Monday, April 29, 2013

Powershell Event : Barcamp9’s Powershell’s Session slides.

Hi

On Saturday i had a great day at “Barcamp9”. It was a successful event and this event is very well planned and very well managed by the event organizers.

In the “Barcamp9 Event”, we got lot’s of nice goodies like Barcaml9 printed T-Shirts, firefox sticker, magnet and pen.

BCD9Goodies

unfortunately, no one was there to take my pictures , so i don’t have any of my event pics :(

You can download the event's slides from the below link.

29-04-2013 22-34-41

Download presentation from this link : http://www.slideshare.net/amandhally/use-powershell-to-make-your-life-easy

 

Thanks
Aman Dhally
 
 
clip_image001 clip_image002 clip_image003 clip_image005clip_image007