Monday, August 27, 2012

Automated script to check the services in Automatic and Manual Mode

This week I am working on some new requirement from our Active Directory Architect to provide all the services required to start as "Automatic" and "Manual" for all my VMWare VDI infrastructure servers.

It is very painful to go to each server one by one to do this, so I written a simple Powershell script to check.

You will need to prepare for a text file (Servers.txt) which list all your servers you want to check. (One hostname in each line). This Servers.txt file should be in the same location as your service.ps1 script.

---start of service.ps1 script----------------------
$compArray = get-content .\Servers.txt
foreach($strComputer in $compArray)
{
echo $strComputer
echo --------------------------------------------------------------------------------------------------
Get-WmiObject Win32_Service -ComputerName $strComputer | Where {$_.StartMode -like "*Auto*"}| select-object DisplayName,Name,StartMode,StartName
echo --------------------------------------------------------------------------------------------------
Get-WmiObject Win32_Service -ComputerName $strComputer | Where {$_.StartMode -like "*Manual*"}| select-object DisplayName,Name,StartMode,StartName
echo --------------------------------------------------------------------------------------------------

}

---end of service.ps1 script----------------------

To run that script, you just need to login with an account with Local Administrator right for all servers needed and run the following command in the Powershell

.\services.ps1 | out-file results.txt

You will then see all services in results.txt. 

Wednesday, February 23, 2011

How to monitor free space of a group of desktop

If you have some special group of desktop shared by a team, you may have the similar issue as me that the hard disk space used up quickly simply because of the temp file (like the ost file of outlook).

I have written a script to monitor the freespace of a few machines...

First of all, I create a freespace.bat file like this

----start of freespace.bat-----



@echo off
for /f "usebackq delims== tokens=2" %%x in (`wmic /node:%1 logicaldisk where "DeviceID='C:'" get FreeSpace /format:value`) do (set  tx1234=%%x)


for /f "usebackq delims== tokens=2" %%x in (`wmic /node:%1 logicaldisk where "DeviceID='C:'" get Size /format:value`) do (set  txsi=%%x)


echo %1;%tx1234%;%txsi%


----end of freespace.bat-----


This script basically will poll the PC that you specified provide the freespace and the disksize of c-drive.

The usage is like this

freespace.bat <hostname>


If you have a list of machines, then, you can simply put their hostname into a text file, e.g. deskfree.txt and then use the following batch file to check their freespace and echo the results into a text file.

----start of mon.bat-------

@echo off
del /q deskfree.txt
for /f %%y in (desk.txt) Do freespace %%y >> deskfree.txt

------end of mon.bat--------

Wednesday, February 9, 2011

How to install apps from Ovi-store into your Satio Phone without hacking phone


If you are the poor Satio users like me who do not have access to Ovi-store and you want to use the latest firmware (or you have to) in order to have the full WXGA video, here's the steps you could follow to install Nokia apps while continue to get the latest update from Sony Ericsson.

1) Download and extract  SISContents

2) Install Firefox in your PC and install the Add-on "User Agent Switcher"

3) Setup a new user Agent which allows you to pre-tend to be a Nokia phone. You can use the string for Nokia 5800 as below



Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0 Nokia5800d-1/10.0.008; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413

4) Next, goto the Ovi-store to download all the apps you want.

5)Then Open the siscontents file extsis.exe the file you downloaded in first step..





















6) then select the sis file which you have downloaded from ovi-store















7) Now You Delete All The Signatures Present in the sis File


















 8) Now Select Sign Package And Follow The Following Steps


















9) Now a new window will pop out to sign the sis file. You need to have a certificate and key file first for your phone. if you have not done it please read my previous post of Get You s60v5 certificate and key form OPDA. If you have the certificate and key files please continue.



















10) Now After this close this window and save your new hacked sis file.















Oh.....in some case, you cannot straightly do this as the file you download from OVI-store are .dm file!!!


Some of the Ovi Store apps downloaded to PC are in DM file format. So, how to install the DM files from Ovi Store on Nokia phone?

You need to open and edit the DM file with a file editor that can deal with binary file format (i.e. hex content not ASCII). My favorite is Notepad++ (powerful open-source editor for Windows), as shown in this “silent” screencast:








  1. Open the DM file with Notepad++
     
  2. Move the cursor from top-left position to the beginning of “z” character and hit DELETE key – that will delete top 4 lines up to the blank space in front of “z” character, as shown in the YouTube video (above).
     
  3. Save and close the edited file.
     
  4. Remove the .dm file extension from file name – if the 2nd last suffix is SIS, then the converted file is in SIS file format, otherwise it is SISX file format.
  5. Then, you can use the same method above to sign the application with your own certificate!!!

Enjoy...

    Tuesday, February 1, 2011

    How to check what kind of hotfix are installed in a PC

    To check what kind hotfix has been installed, we could use a tool Pstools available from Microsoft.

    http://technet.microsoft.com/en-us/sysinternals/bb897550

    The command line is very straightforward, you simply do that by

    psinfo -h

    And then you will see something like this

    P:\Desktop\pstools>psinfo -h
    PsInfo v1.75 - Local and remote system information viewer
    Copyright (C) 2001-2007 Mark Russinovich
    Sysinternals -
    www.sysinternals.com
    System information for \\x12354
    Uptime:                    0 days 21 hours 16 minutes 53 seconds
    Kernel version:            Microsoft Windows XP, Multiprocessor Free
    Product type:              Professional
    Product version:           5.1
    Service pack:              3
    Kernel build number:       2600
    Registered organization:   Fei

    Registered owner:          Fei User
    Install date:              8/6/2010, 8:05:42 PM
    Activation status:         Error reading status
    IE version:                7.0000
    System root:               C:\WINDOWS
    Processors:                2
    Processor speed:           2.7 GHz
    Processor type:            Intel(R) Core(TM)2 Duo CPU     E7400  @
    Physical memory:           3292 MB
    Video driver:              Intel(R) 4 Series Internal Chipset

    Installed     HotFix
    10/6/2010     Microsoft Internationalized Domain Names Mitigation APIs
    10/6/2010     Microsoft National Language Support Downlevel APIs
    11/11/2010    Security Update for Windows Media Player (KB2378111)
    8/7/2010      Security Update for Windows Media Player (KB954155)
    8/7/2010      Security Update for Windows Media Player (KB968816)
    8/7/2010      Security Update for Windows Media Player (KB973540)
    1/10/2010     Security Update for Windows Media Player (KB975558)
    26/7/2010     Security Update for Windows Media Player (KB978695)
    10/6/2010     Security Update for Windows Media Player 10 (KB917734)
    8/7/2010      Security Update for Windows XP (KB941569)
    8/7/2010      Security Update for Windows Internet Explorer 7 (KB974455)
    8/6/2010      Windows XP Service Pack 3
    4/9/2010      Security Update for Windows XP (KB2079403)
    4/9/2010      Security Update for Windows XP (KB2115168)
    1/10/2010     Security Update for Windows XP (KB2121546)
    4/9/2010      Security Update for Windows XP (KB2160329)
    29/7/2010     Security Update for Windows XP (KB2229593)
    1/10/2010     Security Update for Windows XP (KB2259922)
    11/11/2010    Security Update for Windows XP (KB2279986)
    12/8/2010     Security Update for Windows XP (KB2286198)
    ......


    If you are going to feed this information to an automation script so that you can consolidate all inforamtion by yourself, you can use the script like this.

    del checkhotfix.txt /q
    del 0123894985.txt /q
    psinfo -h > 0123894985.txt
    for /f "skip=18 tokens=1*" %%i in (0123894985.txt) do @echo %%i %%j >> checkhotfix.txt


    This script will skip the first 18 lines of the information so you can easily import them into an access or SQL database for further analysis.

    How to extract all email distribution list from Active Directory

    This is a script that I used to extract all distribution list from Active Directory. You can use a tool called csvde.exe from Microsoft to do this job easily.

    csvde -f c:\temp\yourdl.csv -p subtree -l cn,mail,displayName,managedBy  -r "(|(&(objectCategory=Group)(objectClass=Group)(|(groupType=8)(groupType=4)(groupType=2)))(objectCategory=ms-Exch-Dynamic-Distribution-List)(objectClass=msExchDynamicDistributionList))" -j c:\temp -s <your domain>

    You should replace <your domain> with your company's domain information

    Sunday, December 26, 2010

    How to convert a DVD to MP4 for used on Satio using script

    Step 1: Download the Smartripper software and ffmpeg software

    Step 2:  You can use this command line option to extract your DVD and this will create one .vob file for each chapter.

    smartripper -Cs "D:Video*" "D:Audio English AC3(6Ch) 48kHz" -Co "c:\videos\" -Cr -Cf -Cq  -Sk 3 -Sf 2 -So d

    You can specify the output directory by replacing "c:\videos" with any destination you would like to see your vob file.

    Step 3: Once the ripping is completed, you can use ffmpeg command line below to convert the vob file into mp4 files which are suitable for Satio used.

    c:\ffmpeg\bin\ffmpeg.exe  -i %1 -s 640x360 -acodec aac -strict experimental -ar 44100 -ab 128k -vcodec mpeg4  -f mp4 %2


    %1 is the location for your .vob files just generated
    %2 is the name of the mp4 you would like to create

    Thursday, February 1, 2001

    Privacy Policy

    The privacy of our visitors to feil-automation.blogspot.com is important to us.

    At fei-automation.blogspot.com, we recognize that privacy of your personal information is important. Below is information on what types of personal information we receive and collect when you use and visit fei-automation.blogspot.com, and how we safeguard your information. We will never sell your personal information to third parties.

    Log Files

    As with most other websites, we collect and use the data contained in log files. The information in the log files include your IP (internet protocol) address, your ISP (internet service provider, such as AOL), the browser you used to visit our site (such as Internet Explorer or Firefox), the time you visited our site and which pages you visited throughout our site.

    Cookies and Web Beacons

    We do use cookies to store information, such as your personal preferences when you visit our site. This could include only showing you a popup once in your visit, or the ability to login to some of our features, such as forums.

    We also use third party advertisements on gaudi-cclee.blogspot.com to support our site. Some of these advertisers may use technology such as cookies and web beacons when they advertise on our site, which will also send these advertisers (such as Google through the Google AdSense program) information including your IP address, your ISP , the browser you used to visit our site, and in some cases, whether you have Flash installed. This is generally used for geotargeting purposes (showing New York real estate ads to someone in New York, for example) or showing certain ads based on specific sites visited (such as showing cooking ads to someone who frequents cooking sites).

    DoubleClick DART Cookies

    We also may use DART cookies for ad serving through Google’s DoubleClick, which places a cookie on your computer when you are browsing the web and visit a site using DoubleClick advertising (including some Google AdSense advertisements). This cookie is used to serve ads specific to you and your interests (”interest based targeting”). The ads served will be targeted based on your previous browsing history (For example, if you have been viewing sites about visiting Las Vegas, you may see Las Vegas hotel advertisements when viewing a non-related site, such as on a site about hockey). DART uses “non personally identifiable information”. It does NOT track personal information about you, such as your name, email address, physical address, telephone number, social security numbers, bank account numbers or credit card numbers. You can opt-out of this ad serving on all sites using this advertising by visiting http://www.doubleclick.com/privacy/dart_adserving.aspx

    You can choose to disable or selectively turn off our cookies or third-party cookies in your browser settings, or by managing preferences in programs such as Norton Internet Security. However, this can affect how you are able to interact with our site as well as other websites. This could include the inability to login to services or programs, such as logging into forums or accounts.

    Deleting cookies does not mean you are permanently opted out of any advertising program. Unless you have settings that disallow cookies, the next time you visit a site running the advertisements, a new cookie will be added.