Posts

Showing posts with the label Startup Script

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"
Copy a folder: copy-item "\\shared_folder\folder_2be_copied" "c:\users\public\desktop" -Container -Recurse


================================ Free Android Apps:
Click on links below to find out more:
Linux Android App cheat sheet: https://play.google.com/store/apps/details?id=com.LinuxMobileKit
Multiplication Table for early learnershttps://play.google.com/store/apps/details?id=com.TableMultiplication
Catholic Rosary Guide  for Android:
https://play.google.com/store/apps/details?id=com.my…

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:
http://quickbytesstuff.blogspot.sg/2015/06/powershell-move-files-and-change-file.html

================================ Free Android Apps:
Click on links below to find out more:
Linux Android App cheat sheet: https://play.google.com/s…

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\".

Example:
D:\Unity\Project_016\01
D:\Unity\Project_016\02
D:\Unity\Project_016\03

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.
#=====================================================
$computer_name="."
$get_progs=gwmi-classWin32_product-computername$computer_name|where-object {$_.name -match"^Roxio" }
#$$get_progs=gwmi  -class Win32_product | where-object {$_.vendor -match "^Roxio" }
$get_progs
#=====================================================
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:
http://quickbytesstuff.blogspot.sg/2015/11/powershell-list-printers-of-remote.html


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

Cheers!!!

Linux Android App cheat sheet:
https://play.google.com/store/apps/details?id=com.LinuxMobileKit

Change password using command prompt automatically

Get Process ID using Batch File

Image