Skip to main content


Showing posts with the label Startup Script

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 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 get startup items or files

Checking startup items or files, when Windows is starting or upon user successful login is quite important.
Some files need to run on startup so it can be used while the user or computer is being in used.
Or the startup files is set, so when the computer starts the file or items will also start. In this way, you don’t have to remember what things to open when the program or items will run during startup.
Of course, it’s not only the important files will be set during startup. Some viruses or malware sometimes use this method to load the software, so that they will also be in the system as long as the user is logged in.
So, how to check in PowerShell to get all those startup items or files?
Here’s the code:
Sample output:
Description : OneDrive Command: "C:\Users\duser_name\AppData\Local\Microsoft\OneDrive\OneDrive.exe" /background Location: HKU\S-1-5-21-abcdef-007-corona-2020\SOFTWARE\Microsof…

Remove startup files in Windows 10

How to delete, remove the files or program during startup in Windows 10?

To disable the startup program in Windows 10, right click on the task bar choose the empty space and select task manager.

On the Window tabs, Processes, Performance, etc. click on "Startup".

Right click on the program you want to manage select "Disable" if you need to disable, or if you need to enable it again select "enable" of course.

There's also an option "Open File location"|, if you need to check the  exact location of the program or file.

If you need to add custom files to start-up folder, the path would be:

C:\Users\\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Or open run box, by pressing shortcut key Windows + R and on the run box type: shell:startup

This will open the startup folder path location stated above.

Till next time. Cheers!

================================ Free Android Apps:
Click on links below to find out more:
Catholic Rosary Guide  …

PowerShell disable USB ports

Disabling USB ports using PowerShell by modifying registry values.
How to user PowerShell to modify an existing value in Windows Registry?
PowerShell code below modifies the registry value and disable USB ports in Windows.
The code must be run in an elevated mode to modify the registry.
Here's the code:
Modify the registry key value using PowerShell:
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\USBSTOR\" -Name "start" -Value 4
To enable the USB ports, change the value to 3:
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\USBSTOR\" -Name "start" -Value 3
Disabling USB ports is quite annoying of course, but if security is a concern then I guess it is justifiable especially computers that can easily be accessed by unwanted guests or individuals.

It will also protect the network or computers from getting malware's or viruses that is transferred or copied via USB storage.

Cheers! Till next time.


PowerShell copy file, link or folder to users’ desktop

Deploying a shortcut link, file or folders can easily be done via group policy preferences.
Or it can also be done using PowerShell as logon or start up script.
A one liner code snippet to deploy a file, a shortcut links or a folder to user’s desktop.
Copy a file: copy-item "\\shared_folder\files_2be_copied.txt" "c:\users\public\desktop"

Copy a shortcut link to user desktop: copy-item "\\shared_folder\shortcut_file_2be_copied.lnk" "c:\users\public\desktop"

If a link or shortcut which is a network path, just need to ensure that the permissions is set correctly or else the link will be deployed but still unable to access due to permission issue.

Copy a folder: copy-item "\\shared_folder\folder_2be_copied" "c:\users\public\desktop" -Container -Recurse

Above command will copy the whole folder to the user's computer, if space is an issue then a shortcut to the folder would be desirable.

================================ Free Android A…

PowerShell move matching files in a folder

Requires PS 3.0
This is a two lines code snippet to move matching files in a source folder to another folder.

$SourceFolder = "C:\File_monitor_records\"
# Find all files matching *.csv in the folder specified  # Find csv files with 2016 in its filename Get-ChildItem -Path $SourceFolder -Filter *2016*.csv | move-item  -destination C:\File_monitor_archives\2016\

-Filter *2016*.csv –adjust or create your own pattern, use regex if necessary
Test the pattern before moving the files to make sure correct files are being moved. Check and double check, to avoid wasting time and effort.
This will just like matching files.

Get-ChildItem -Path $SourceFolder -Filter *2016*.csv

Move files and change file name:

================================ Free Android Apps:
Click on links below to find out more:
Linux Android App cheat sheet:…

Copy folder/file to multiple folders

Copy a single folder to multiple folders?

Copy a file to multiple folders?

This can be done easily using PowerShell script.

Script below requires PS 3.0, but it can easily be tweak for other version.

Here's the script:

$source_folder="D:\xfolder\United Folders"
dir -Directory "D:\Unity\Project_016\" | ForEach-Object {
write-host $_.fullname
Copy-Item -Path $source_folder -Destination $_.FullName


What the script does is the $source_folder is to be copied to all folders in the destination.

Basically, the "United Folders" is to be copied to the root of the sub folder in destination folder which is "D:\Unity\Project_016\".


After executing the script, the folders will look like this:
D:\Unity\Project_016\01\United Folders
D:\Unity\Project_016\02\United Folders
D:\Unity\Project_016\03\United Folders

It dep…

PowerShell get installed software on remote computers

How to get or list installed softwares on remote computers?
Check installed programs or softwares on remote computers using PowerShell.

PowerShell can do the task easily to get software installed on remote computer provided the script is run with proper privileges

Here’s the script below on how to list of installed software on remote PCs.
$get_progs=gwmi-classWin32_product-computername$computer_name|where-object {$ -match"^Roxio" }
#$$get_progs=gwmi  -class Win32_product | where-object {$_.vendor -match "^Roxio" }
Sample output:               IdentifyingNumber : {1F54DAFA-9261-4A62-B59D-6C9F26B48FE4} Name              : Roxio Creator Tools Vendor            : Roxio Version           : 3.8.0 Caption           : Roxio Creator Tools
IdentifyingNumber : {08E81ABD-79F7-49C2-881F-FD6CB0975693} Name              : Roxio Creator D…

WMIC List printers

WMIC comes handy if you are a command line junkie.

To list printers via command line type:

wmic printer get name  = = = this will list all the printers installed on a workstation

To list the printer name and the port name of the printers, type this command:

wmic printer get name, portname

Type this command below to list the printer drivers:

wmic printer get name, drivername

To get the device id:

wmic printer get name, deviceid

You can deploy a batch file startup script to check which printer is installed on the computers and redirect the output to a shared folder.

PowerShell can also be used in conjunction with WMIC command:

Get Printer Driver Path and Name:

To see more WMIC tips, click on WMIC label below.



Catholic Rosary Guide  for Android: Pray the Rosary every day, countless blessings will be showere…