Skip to main content

Posts

Showing posts from 2018

Check if 32 bit or 64 bit processor from command line

How to check processor architecture whether its 32bit or 64bit?
One method is to query the registry from the command line.
Here’s a one liner command line that will check whether the PC processor is 32bit or 64bit.
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" | find “ARCHITECTURE”
If the output is something like this:
PROCESSOR_ARCHITECTUREREG_SZAMD64

Then it’s a 64bit, if it shows x86 then it’s a 32 bit.
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" | find “IDENTIFIER”
Above query can also identify, the output shows Intel64 for 64bit.
Sample Output: PROCESSOR_IDENTIFIERREG_SZIntel64 Family 6 Model 142 Stepping 10, GenuineIntel

Omitting the find option from the “reg query” command will show quite a few information.
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
This query command works in Windows 7, Windows 8 and Windows 10. I believe this will also work in Windows s…

Linux copy files and change date or time

So, you want to copy files from one folder to another folder and change both the source and destination timestamp?
Linux can easily change or modify the timestamp with ‘touch’ command.
A one liner command with the help of ‘pipe’ to pass the arguments and ‘xargs’ to execute multiple commands in a single line can easily accomplish this task.
Command below will copy the files in the current directory where ‘ls’ command is executed to the directory ‘xfiles’, timestamp will be changed to 7 hours less from the current time.
ls | xargs -I % sh -c 'touch -d "7 hours ago" %; cp -p % ./xfiles';
-p option is important to preserve the modified timestamp
Note: the above command will change the timestamp for both source files and destination files.
Command below will change the source timestamp, but the destination timestamp will be the date and time that the command was executed.
ls | xargs -I % sh -c 'touch -d "2 Aug" %; cp % ./x';

Notice, that the -p option is omitted …

WSUS – quick installation guide

WSUS or Windows Server Update Services is patching system for Windows OSes and other Microsoft products.
In Windows 2016 or another version of Windows server it’s quite straight forward to install or config ure WSUS. Make sure the server has enough memory and has sufficient space to download and store updates.
Plan accordingly the computer groups in WSUS, like 1 group for Testing updates and 1 group for production or other methods or strategy that is right for the environment.
Configuring WSUS should be straight forward but in some instances, it may not work right after installing the WSUS server role.
First, install and configure WSUS server role.
Second, configure GPO to point to WSUS server. If the clients will not know where to find or report to a WSUS server then WSUS sever will be empty. WSUS server will not be able to detect client or server devices.
In GPO you need to set the settings of how you are going to carry out the updates, like the time to install the updates, and a notific…

How to open an elevated command prompt from a standard account?

Working in a fast pace environment, will need to get things done quickly to do other tasks that needs to be done also.
Opening a command prompt in a standard user account without signing off and without logging off is possible with the “runas” utility command in Windows environment.
Open the run box and type “cmd”, to open the command prompt window.
Then type:
Runas /user:admin_account cmd
It will ask for a password, if authentication is valid then a new command prompt window will open in an elevated mode. Command works from Windows 7+  version.
That’s it, you just open an elevated command prompt window in a user standard account. Since most users are hungry with the admin password, just watch out with the shoulder sniffing tactic.

Other useful admin commands in a windows environment:
If ever you have a custom local admin account name and you can’t remember, type: net users
It will display all the local user accounts.
To check domain name and current login user account name, type:
Who…

Ping IPv4 or IPv6 in Windows 10

Windows 7 and newer releases of Windows supports ping results of either IPv4 or IPv6.

If the remote PC or server is configured for both IPv4 and IPv6, and if you need to ping via hostname and you want to get an IPv4 address type the command below:

ping -4 -n 2 Dhoney_Srv

Output will be IPv4 address of the hostname

ping -6 -n 2 Dhoney_Srv

Output will be IPv6 address of the hostname.

-n 2 send two ICMP packet requests.


Cheers! Till next time.


================================ Free Android Apps:
Click  links below to find out more:
Excel Keyboard guide:
https://play.google.com/store/apps/details?id=chrisjoms.myexcelapplicationguide
Linux Android App cheat sheet: https://play.google.com/store/apps/details?id=com.LinuxMobileKit
Heaven's Dew Fall  Prayer app for Android :
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Catholic Rosary Guide  for Android:
https://play.google.com/store/apps/details?id=com.myrosaryapp
http://quickbytesstuff.blogspot.sg/2014/09/how-to-recite-rosary.h…

Activate Windows from command line

How to activate Windows from command line?
If you have decided to convert an evaluation Windows server (Windows 2016 or other server version), or Windows 10 to a license Operating system then you need to replace the product key. You will need to change the product key and activate the system, in order to use the product outside of its evaluation period.
Assuming you have done the steps of converting the evaluation software and all the evaluation packages has been removed. Of course, if you have plenty of time in your hands and you just want to redo everything then you can just install or setup a new environment.
To activate a new product key from command line, first the product key must be installed and replaced the existing one. Second, activate the product key.
Here’s how to do it via command line:
a. slmgr /ipk windows-product-key-with-slashes
/ipk = installed product key windows-product-key-with-slashes – replace this with the actual windows product key
If everything goes well there will b…

How to search for string in Excel

There’s quite a lot of ways to do this in Excel, using Macro or Excel formula will be able to get the desired output.
Macro I think is good if the number of rows is not so large, but if the number of rows is quite large then a buffer overflow error might occur.
Formula can take quite large of data and able to deliver the result as expected.
ISNUMBER is a function that can check whether value is a number or not, the function itself tells what the formula will be doing.
Adding a search function to ISNUMBER then it can be used to search for a string with in a cell or the specified range in the formula.
Example below shows how ISNUMBER can be used to search for a specified string whether it exists or not. The position of the string doesn’t matter as long as the string exist within the cell, the formula will return TRUE, otherwise it will return FALSE if the string does not exist.
Here’s the example:
=ISNUMBER(SEARCH("search string", A5))
The “search string” is the string that will be se…

Change Password of Scheduled Tasks in PowerShell

How to change Tasks Scheduler password?
How to set a new password for scheduled tasks in Windows Task Scheduler using a script?
PowerShell is always a friend to cure laziness in an effective and efficient way.
Of course, not all things can be done by automation. Sometimes manual method is more applicable and a secure method on some scenario.
If you have a few servers that has scheduled tasks on it and need to change the password occasionally to comply with cyber security policies, changing tasks manually might be painful and chances are some tasks might be missed.
Changing the password in Task Scheduler using PowerShell is an efficient method if the task has to be done repeatedly on a few servers.
To change the password, the TaskName must be known since it’s an input or a required field for the command used to change the Task password.
To get Tasks Name use the PowerShell code below:
Get-ScheduleTask - TaskPath "\"| Get-ScheduledTaskInfo
The TaskPath refers to location of the Task Na…

SQL delete value in a column

Deleting a value in a column can be done in multiple ways in SQL, mileage will always vary. If you have been working in SQL for quite some time and you were able to get the pinch of SQL then single liner statements can be done easily.
Deleting a single field or a single value in a column that matches a string or data using SQL is a daunting task, so it's better to practice with a dummy data before executing the statement on a production database or else inadvertent consequences  might happen.
One liner statement below will delete a value that matches the variable in query. Below is a PHP statemen that will delete a value in a column that matches the variable supplied on the statement.
The “.”, dot or period is a concatenation operator for strings in PHP.
"DELETE FROM `Table_Name`WHERE column_name = " . " ' " . $variable_query . " ' ";
Replace Table_Name with the actual table name and the column_name also with the actual column name.
The $variable_qu…