• You can pass the remote system name to the function as a parameter and you should get results for that server. Like :

    Get-FreeSpace -HostName Servername

    the only thing you need to take care of is that the remote system is connect to your machine through the network.

    You can also use xp_cmdshell to run this. My advise would be to save the function script as a file and then use xp_cmdshell to call that file.

    exec xp_cmdshell 'powershell.exe -c "c:\temp\Get_freespace.ps1"'