Skip to main content


Showing posts with the label security

Copy a single file using robocopy

Copy a single file using robocopy from a local folder to a shared folder on the network.
A simple rule of thumb before any disaster strike, don't interchange the source and the destination.

If source and destination is mistakenly reverse, files might get overwritten. To avoid any loss of data do a test with a dummy file to ensure things work perfectly.
Robocopy [source][destination]   [file to be copied]
robocopy c:\local_c_folder  \\PC_network\shared_folder   file_to_be_copied_xx.txt
The command will be completed successfully provided the network access right has no issues.

Robocopy works quite good on large files. A simple copy or xcopy command will also work but the speed might vary.

However, if the file (ex. an ISO file) and is more than 4GB and the filesystem  of the thumbdrive or the storage is FAT system, then robocopy or any methods of copying will not work. Since FAT has a file size limitation of less than 3GB.

Robocopy is free it can be accessed from command line. No ne…

PowerShell check if port is open

PowerShell code snippet to check or test whether a port is open or closed on the IP Address specified.

$port_num= "2443" $IP_Add=""
$result = New-Object Net.Sockets.TcpClient $IP_Add, $port_num
if($result.Connected) { write-host "Port 443 is open." $result.close() } else { write-host "Attempt to connect failed, check firewall or other settings." } ==============================

If port 2443 is open in IP Address then PowerShell script will show "Port 443 is open."
If port 2443 is close the script will show "Attempt to connect failed, check firewall or other settings."
If the port is closed it could be that the firewall is not set to accept incoming connections for the particular port.
Do not set firewall settings to open any port if it is not necessary to do it.
If the service or application that is using the port is not operational anymore then close the port that was used by the app…

Netsh show firewall state

How to check Windows firewall advance security current state using command line?
Command line below will check whether the firewall state is on or off.

To check the firewall state via command line type:
   netsh advfirewall monitor show firewall
Command above will display the current firewall state.
If the state shows “ON” the firewall is working.

Sample output:
Domain Profile Settings: ---------------------------------------------------------------------- State                                                   ON Firewall Policy                                   BlockInbound,AllowOutbound LocalFirewallRules                            Enable LocalConSecRules                             Enable InboundUserNotification                   Enable RemoteManagement                          Disable UnicastResponseToMulticast            Enable
Logging: LogAllowedConnections                   Disable LogDroppedConnections                   Disable FileName                                        …