≡ Menu

Find OS images inside WIM file using PowerShell

WIM(Windows Imaging Format) file can contain one or more images based on how it was prepared. The Operating System ISO file provided by Microsoft will have WIM file with several images init for different versions of operating system. The purpose of this post is to show you how to see the images inside it.

In this case ISO file is mounted to D: drive so the path of Install.wim file is D:\Sources\Install.wim

Get-WindowsImage -ImagePath D:\Sources\Install.wim

This will list images inside the ISO file. The output of above command gives output similar to below.

 

Hope this helps.

 

{ 0 comments }

Mount a image file(WIM) using Powershell

Sometimes you are required to Mount WIM (Windows Image Format) files to perform actions like reading the content or updating the image itself. DISM.exe is a very good utility to perform these from command line.  Starting Windows 8/Windows Server 2012 Microsoft added a new PowerShell module called DISM. Now we will see how to use that module to mount a WIM image.

Mount-WindowsImage cmdlet in DISM module has the functionality to mount a WIM file to one of the directory on the file system.  You can run below command to mount install.wim file from installation media to c:\installsource folder.

Mount-WindowsImage -ImagePath D:\Sources\Install.WIM -Index 2 -Path C:\InstallSource -ReadOnly

 

Here, D:\Sources\Install.WIM is the image file, Index is used to identify the OS from the list you have in image file. Path is to specify the mount directory on the file system. -ReadOnly specifies that no changes should be saved or committed to the WIM file.

 

{ 0 comments }

Hide Acrobat Reader Tool bar in Mac/Windows

Side bar(Tool bar) that appears with Adobe Acrobat Reader with options like Export PDF, Create PDF, Edit PDF, etc, is frustrating sometimes as you don’t find a way to close/minimise it. When reading any PDF files, it is taking at least 30% of the screen space.

Acrobat Reader RC disable Tool pane

There is an option to disable this tools pane but it is not working as expected. If you want you can try it as well by following the below instructions.

  1. Go to Edit > Preferences (or press Ctrl+K in Windows and Command+K in Mac)
  2. Go inside “Documents” section
  3. uncheck “Open tools pane for each document”.

There are some forums which are advising to edit a XML file to get rid of this tool bar pane, but for a normal user they are little complex.

One quick and easy way that I came across is a key combination. See below based on your operating system.

Windows : SHIFT + F4

MAC : SHIFT+Fn+F4

Pressing above key combination toggles the tool bar pane in acrobat reader. So you can easily enable or disable as you need.

{ 1 comment }

PowerShell: How to query date time without seconds

How many times you got a need for querying the date time variable using Get-Date or [DateTime]:Now but without seconds value in it or making it as 00 seconds? Let us find out what are the options to achieve this using PowerShell.

By default Get-Date cmdlet gives seconds as well. In some cases we feel reading till minutes is sufficient or we want to round off to 00 seconds. This is possible if you decide to convert time value to a string as shown below.

$datetime = Get-Date -Format “yyyyMMddHHmm”

[datetime]::ParseExact($datetime,“yyyyMMddHHmm”,$null)

While this is good, I was looking for better approaches to do this without actually converting it to a string. Lucky I came across one.

This approach is simple which deducts seconds from current date time value to make it zero.

$datetime = Get-Date

$datetime.AddSeconds($datetime.Second)

date-time-without-seconds

Hope you liked it.

{ 2 comments }

How do we know if a variable of type [DateTime] is in UTC or Local time zone? Let us see how to achieve this using PowerShell.

First you need to ensure that date time information is stored in proper DateTime variable. To check you can invoke GetType() method on the variable that is containing the date time information and it tells us whether it is of date time type or not.

$Date = Get-Date

$Date.GetType()

get-date-time-type

 

Once it is confirmed then you can check if the time in the variable is a local time or in UTC timezone by reading the Kind property value. This property has 3 possible values.

  1. Local : The time represented is local time.
  2. UTC : The time represented is UTC.
  3. Unspecified: The time represented is not specified as either local time or Coordinated Universal Time (UTC).

Let us see a quick example:

$Date = Get-Date

$Date.Kind

$UTCDate = $Date.ToUniversalTime()

$UTCDate.kind

A sample screenshot of output is below:

date-time-kind

Hope you liked it. Do you know how to find the exact time zone of a date time variable? I will come up with another post for it.

{ 0 comments }

There are several complains around internet that browser links(especially from Google search results) are not working after upgrading iOS to 9.3. This is noticed on my iPhone today with following symptoms.

Problem

  1. Right click on results from Google search results in Safari browser not working and hanging the Safari browser
  2. Selecting a link in Google search results not working. The page is not going anywhere.
  3. Same problem is noticed with Google Chrome on iPhone
  4. I have not tested with firefox but there are people complaining similar things with it in forums

If you are also facing similar issues and looking for a fix, then you might want to try disabling Java scripts in Safari browser. This worked for me. One thing I noticed is the richness of google search is lost after disabling the Java scripts. This seems expected since Google runs a lot of Java scripts to provide better user experience.

Solution

  • Go to Settings
  • Scroll down to Safari and select it

Safari Advanced Settings

  • Again scroll down till you see Advanced and select it

 

Safari Settings

  • Now slide the bar again Java Scripts to disable the functionality.

Settings

Hope this helps. From the threads in Apple forums I read that Apple is aware of this problem and working on addressing it. Till they come up with a fix, you may want to start using above work around.

Do you know any other better solution or tips for making links in Google search work for Safari browser? Please write in comments section, I am happy to append here.

{ 0 comments }

How to cancel Netflix India subscription

A bit out of topic for this blog, but useful for people who look for unsubscribe option like me. Last month I subscribed to Netflix subscription in INDIA with an excitement But after a month I decided to end the subscription due to some reasons. Personally, I am very happy to see Netflix in INDIA with access to lot of US based movies and TV shows. I am looking forward to see more content coming in.

Initially I was not clear how to unsubscribe. After exploring a bit, I found the easy way.

You just need to visit https://www.netflix.com/CancelPlan and login with your Netflix account. And then you will see a Finish cancellation button like shown in the picture. Click on it and you will see a confirmation message.

NetFlix-unsubscribe-india

The message is clear that my subscription will be active for the current billing cycle as I already paid for it. You can visit http://gadgets.ndtv.com/internet/features/how-to-cancel-your-netflix-subscription-797974 for more options to unsubscribe from Netflix.

{ 2 comments }

C# typeof equivalent in PowerShell

Those who are good with C# knows what typeof does. Basically is used for finding the type data of a given variable or object. How do we do this when it comes to PowerShell? Is there any equivalent keyword for typeof in PowerShell? Let us find out.

PowerShell implements typeof in little different way. Instead of using the typeof keyword like in C#, the PowerShell provides a method called GetType() for each variable or object to find its type. For example, if you want to find data type of a variable called $username, you can know it by calling $username.gettype().

$username = “techibee”

$username.GetType()

PowerShell Typeof equivalent

You can also check if the returned type is a string, integer or some other data type by comparing it as shown below.

$username = “techibee”

$username.GetType() -eq [string]

$age = 12

$age.GetType() -eq [int32]

$age.GetType() -eq [string]

PowerShell typeof

Do you know any other case where PowerShell’s Gettype() cannot replace typeof keyword in C#? Please post in comments section.

{ 0 comments }

With the increase in use of Windows 10 operating system, you may want to find out how many Windows 10 computers are currently added to your Active Directory Domain. This code snippet will help you to query this information and export it to excel or CSV.

Get-ADComputer cmdlet in ActiveDirectory module is used for querying Computer account details and we can use it to query Windows 10 installations as well. It queries all computers that containing any version of Windows 10 Operating system.

Import-Module ActiveDirectory

Get-ADComputer -Filter { OperatingSystem -like “Windows 10*” } -Properties OperatingSystem

This code needs ActiveDirectory PowerShell  module. You can also try exporting it to CSV by piping the output to Export-CSV cmdlet.

Import-Module ActiveDirectory

Get-ADComputer -Filter { OperatingSystem -like “Windows 10*” } -Properties OperatingSystem | Export-Csv c:\temp\windows10comps.csv -NoTypeInformation

You will see the output recorded in c:\temp\windows10comps.csv file.

{ 0 comments }

Reversing a array using PowerShell

Array is a collection of items. Sometimes we needed to reverse or inverse a array collection. There are many approaches available in PowerShell for doing the reverse or inverse operations but the approach talked in this article is most easiest one.

Reversing String Array using PowerShell

The [Array] accelerator in PowerShell has a static method called reverse() which can be used to reverse a array. This method really doesn’t distinguish whether it is string array, number array or any other kind of array. All it does is reversing it. Though array type is not a matter, I have given a examples for each array type below for better understanding.

$StringArray = @(“abc”,“xyz”,“thn”)

$StringArray

[array]::Reverse($StringArray)

$StringArray

Reversing String Array

Reversing String Array

Reversing numeric array using PowerShell

Below is a example for reversing a numeric array using PowerShell.

$numbericarray = @(1,2,4,3,6,9,7)

$numbericarray

[array]::Reverse($numbericarray)

$numbericarray

Reversing Numeric array

Reversing Numeric array

Reversing Characters array using PowerShell

Below example is for reversing a characters array. Approach is similar to reversing number or string based arrays.

$chararray = @(‘a’,‘c’,‘g’,‘d’,‘r’)

$chararray

[array]::Reverse($chararray)

$chararray

 

Reversing Char array

Reversing Char array

Hope this article helps.

 

 

{ 0 comments }