Skip to main content


Showing posts with the label vbscript

Type equal sign in Excel without evaluating

Typing equal sign in Excel will trigger Excel to evaluate the contents or the formula that is being typed.
But how to type equal sign plus the contents without evaluating the formula?

Or how to display a formula in a cell using Excel?
In VBA, Excel Macro, VBscript and VB.Net; to put comments or remarks on the code is to use single quote.
A single quote tells the engine that whatever that follows from the quote is a string and not a command and should not be evaluated.
In this way, you can type anything after the single quote “ “.
So, this goes the same way in the Excel interface.
If you want just to show the formula for remarks or whatever purposes but don’t want Excel to evaluate the contents, then just type a single quote before the equal sign or the formula.
Example: ‘=1+1
Excel will just display =1+1 It will be treated as a literal string. Of course, without the single quote then the result will be displayed.
See image below:

That’s it, you can use a single quote to treat formu…

PowerShell get screen resolution

Check screen resolution of the monitor using PowerShell.
Get-WmiObject-Query"Select * from Win32_desktopmonitor"-Namespace'Root\CIMV2'|selectname,screenheight,screenwidth
Sample output:
namescreenheight screenwidth ---------------- ----------- Default Monitor Generic PnP Monitor 10801920

To check remote PCs, use the code below, of course proper credentials is required.
Invoke-Command-ComputerName192.168.1.20-ScriptBlock { Get-WmiObject-Query"Select * from Win32_desktopmonitor"-Namespace'Root\CIMV2'|selectname,screenheight,screenwidth }
Some application requires or either work properly when a particular screen resolution is properly set or configured.
To get more details like video processor, driver version and driver date use the code below. Updating drivers is quite important as it will improve device performance and other update features.
Get-WmiObject-Query"Select caption,driverdate,driverversion,videoprocessor from Win32_videocontroller"-N…

PowerShell check sound devices

PowerShell code below will list the names of the sound devices and its status on the system.
The status might show OK, I believe this refers to the driver installation but if some settings are misconfigured that will be another issue.
Here’s the code:
Get-WmiObject-Query"Select * from Win32_sounddevice"-Namespace'Root\CIMV2'

Sample output:
ManufacturerNameStatus StatusInfo ---------------------- ---------- Intel(R) Corporation Intel(R) Display AudioOK3 (Generic USB Audio)USB Audio DeviceOK3 RealtekRealtek High Definition Audio OK3

Cheers..till next time. :)

================================ Free Android Apps:
Click  links below to find out more:
Excel Keyboard guide:

Heaven's Dew Fall  Prayer app for Android :
Catholic Rosary Guide  for Android:

PowerShell get Printer Name and Driver path

Descriptive Printer name is quite useful especially if managing quite a few printers on a network. Knowing the driver path of the printers is also useful, the file can be copied and can be used to install on another computer if necessary.
Here’s the PowerShell code:

Get-WmiObject-Query"Select DriverPath, Name from Win32_printerdriver"-Namespace'Root\CIMV2'|SelectName,DriverPath|ft-wrap
Sample Output:

Cheers..till next time. :)

================================ Free Android Apps:
Click  links below to find out more:
Excel Keyboard guide:

Heaven's Dew Fall  Prayer app for Android :
Catholic Rosary Guide  for Android:

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