Skip to main content

Posts

Showing posts with the label CMD

Read or get the list of contents on S3 bucket

S3 or Simple Storage Service bucket is quite handy to store files or any data on AWS cloud.As with any storage, online or offline organizing the data is quite an issue.When there are a lot of files of data on the storage; finding the data that you will need will be difficult. Especially, if the data or bucket is not organized properly. And even if the data has been organized by folders with proper time stamp but no specific data catalog to classify which one is which one it is quite a challenge to find or get the data on time.S3 is ideal for backup, since backup is often accessed only when it is needed. So, familiarization of the backup folder structure is necessary. In order to find or get easily the data, listing the contents of the S3 bucket is a good option when unable to find the files or data needed.Once the list is ready, opening the list via editor such as notepad and searching or finding thru the editor will provide an option to find things quickly and easily.
How to list the …

PowerShell launch an application and close it automatically

Code below will run an application and PowerShell will also close it after a few seconds.$process_id=Invoke-CimMethodWin32_Process-MethodName"Create"-Arguments @{CommandLine ='cmd /c "C:\dev\remind.bat"'} |Select-Objectprocessid|ft-HideTableHeaders|Out-StringStart-Sleep-Seconds2.5stop-process$process_idSample contents of remind.bat:
@echo off
echo "Shutdown the server. Do it now."
Notepad
==================Notepad is on the batch file so the command window will stay on the top of any running applications.Sample output of the above code:
Code below will run calculator and close after a few seconds specified on the code:Invoke-CimMethodWin32_Process-MethodName"Create"-Arguments @{CommandLine ='calc.exe'} |Select-Objectprocessid|ft-HideTableHeaders|Out-StringStart-Sleep-Seconds2.5$get_process_id=Get-Process-Namecalcu*|<

PowerShell GUI with buttons, textbox and combobox

GUI makes life easier, but of course command line has a power of its own.
How to add a form in PowerShell with Buttons, TextBox and ComboBox?
Adding GUI forms in PowerShell must be done manually by code.
It’s not that hard, you just need to love PowerShell and see what it can do to automate IT administration and makes your life easier.
Anyway, code below introduces how to add GUI to PowerShell and it also illustrates how to make use of those GUI buttons and send a command to remote computers.
Code to add buttons, textbox and combobox in PowerShell, and how to execute a command after the button is clicked.
#initialize the main form $form=new-objectWindows.forms.form $form.text ="Server Selection Form"
$form.minimumSize =New-ObjectSystem.Drawing.Size(600,300) $form.maximumSize =New-ObjectSystem.Drawing.Size(600,300)
#add a button to the form $button=new-objectwindows.forms.button $button.text ="Close Me"
#action that the button will execute after it has been clicked

How to check office version from command line

The are quite a few ways to check office version it can be done via registry, PowerShell or VBScript and of course, good old command line can also do it.
Checking Windows office version whether it is Office 2010, Office, 2013, Office 2016 or other version is quite important to check compatibility of documents; or just a part of software inventory.
For PowerShell this simple snippet can check the office version:
$ol=New-Object-ComObjectExcel.Application $ol.Version
The command line option will tell you where’s the path located; the result will also tell whether office is 32-bit, 64-bit and of course the version of the office as well.
Here’s the command that will check the office version and which program directory the file is located which will tell whether it’s 32-bit or 64-bit.
Command to search for Excel.exe:
DIR C:\ /s excel.exe | find/i "Directory of" 
Above command assumes that program files is on  C: drive.
Sample Output, if 64-bit version:
Directory of C:\Program Files\…

WMIC command get CPU Load Percentage

Getting CPU load percentage is quite helpful in determining whether the server or computer is on a heavy performance, this would also indicate whether there is a need to increase the memory or add another CPU to the machine.

Of course, when the CPU has a lot of load, performance will be impacted directly. Which basically means that the machine will not be working perfectly.
Checking the CPU load will also help to troubleshoot, if the services on the machine or server is experiencing slow performance.
Here’s the wmic command line which check the CPU Load Percentage.
wmic cpu list status

Sample output: AvailabilityCpuStatusCurrentVoltageDeviceIDErrorCleared 319CPU0
ErrorDescriptionLastErrorCodeLoadPercentageStatusStatusInfo 15OK3

The command can be used to monitor remote servers or computers to check the load percentage and just save the output to a text file for review or monitoring purposes.

Cheers..Till next time. Hope it helps. 😊

================================ Free Android Apps:
Clic…