June 15 2017

Syncing OneDrive folder located across multiple disk drives

OneDrive doesn’t have the option to select folders from multiple disk drives – this wasn’t a problem for other online storage/synchronization tools that I have used previously, however OneDrive wants you to simply selection one “root” folder and it will only included files/folders beneath that.

I have a scenario where I have a 100GB SSD disk for frequently accessed files and a 1TB slower SATA disk for photos and archives. I have files and folders in both drives that I want to be synchronized to the OneDrive “Cloud”.

So to do this I needed to use the Windows command line tool MKLINK to create a symbolic link.

C:\Users\danovich\OneDrive\         <——- “Root” OneDrive folder, located on the 100GB SSD drive
D:\Data\Photos\         <——- Photos folder, located on the 1TB SATA drive, containing 500GB of photos I want to be sync’d into OneDrive

Open a command prompt with admin privledges and type:

mklink /d "C:\Users\Dan\OneDrive\Photos" "D:\Data\Photos"

You’ll get a success message:

symbolic link created for C:\Users\Dan\OneDrive\Photos <<===>> D:\Data\Photos

Data will now be syncing with OneDrive and the “Photos” symbolic link, essentially a shortcut, will appear in the OneDrive folder:

March 31 2014

Powershell script to ping and check ports 80 & 443

A while back I created a very simple PS script for pinging a list of servers (http://blog.danovich.com.au/2009/06/10/nifty-powershell-script-to-ping-multiple-servers/). I’ve make a few changes to it recently including a couple of columns to check for TCP port 80 & 443 connectivity. Expect an output to Excel similar to this:

Ping script


$erroractionpreference = "SilentlyContinue"
$a = New-Object -comobject Excel.Application
$a.visible = $True
$b = $a.Workbooks.Add()
$c = $b.Worksheets.Item(1)
$c.Cells.Item(1,1) = "Machine Name"
$c.Cells.Item(1,2) = "Ping Status"
$c.Cells.Item(1,3) = "IP Address"
$c.Cells.Item(1,4) = "Port 80"
$c.Cells.Item(1,5) = "Port 443"
$d = $c.UsedRange
$d.Interior.ColorIndex = 19
$d.Font.ColorIndex = 11
$d.Font.Bold = $True
$intRow = 2
$colComputers = get-content C:Tempmachinelist.txt
foreach ($strComputer in $colComputers)
$c.Cells.Item($intRow, 1) = $strComputer.ToUpper()
# This is the key part
$ping = new-object System.Net.NetworkInformation.Ping
$Reply = $ping.send($strComputer)
if ($Reply.status -eq "Success")
$c.Cells.Item($intRow, 2) = "Resolved & active"
$c.Cells.Item($intRow, 3) = $Reply.Address.ToString()
elseif ($Reply.status -eq "TimedOut")
$c.Cells.Item($intRow, 2) = "Resolved host but timed out"
$c.Cells.Item($intRow, 3) = $Reply.Address.ToString()
$c.Cells.Item($intRow, 2) = "Unable to resolve"
$socket80 = new-object Net.Sockets.TcpClient
$socket80.Connect($strComputer, 80)
if ($socket80.Connected) {
$c.Cells.Item($intRow, 4) = "Open"
$c.Cells.Item($intRow, 4) = "Not Open"
$socket443 = new-object Net.Sockets.TcpClient
$socket443.Connect($strComputer, 443)
if ($socket443.Connected) {
$c.Cells.Item($intRow, 5) = "Open"
$c.Cells.Item($intRow, 5) = "Not Open"
$Reply = ""
$intRow = $intRow + 1




March 27 2012

Running multiple commands in SCCM ‘Run Command Line’ Task Sequence step

A quick post on something that’s not overly technical. I was editing a SCCM task sequence and I wanted to run multiple commands on the task sequence ‘Run Command Line’ step without using a batch file.  I remember that Command Processor allows the & character to join commands together. I tested this out in the task sequence step and it work successfully. In this example it was “cmd /c del c:windowssystem32hal.dll /Q & cmd /c del c:windowssystem32ntoskrnl.exe /Q & cmd /c del c:windowssystem32ntkrnlpa.exe /Q ”