Maybe the remote PC has an older version of PowerShell that won't automatically run native commands. Try this:
$test = 'sxx'
Invoke-Command -ComputerName ********* -ScriptBlock {
Invoke-Expression "icacls O:\hjemmeområde\$($args[0]).ssb /grant $($args[0])':(oi)(CI)(F)' /t"
} -ArgumentList $test
If you're on PoSH 3 or greater you could also try using the remote variables instead of the Argumentlist:
$test = 'sxx'
Invoke-Command -ComputerName ********* -ScriptBlock {
Invoke-Expression "icacls O:\hjemmeområde\$using:test.ssb /grant $using:test':(oi)(CI)(F)' /t"
}
If these options do not work try replacing Invoke-Expression with Write-Host to check if the command you're trying to run is what you'd expect.
MicaH
itmicah.wordpress.com