I use a scriptblock to connect to a computer, get some info and store that info into a variable, some basic stuff
Code: Select all
function Get-BitlockerEncryptionStatus ($DeviceName)
{
$scriptBlock = {
Get-BitlockerVolume -MountPoint "C:"
}
$Script:BitlockerInfos = Invoke-Command -ComputerName $DeviceName -ScriptBlock $scriptBlock
return $BitlockerInfos
}
Get-BitlockerEncryptionStatus ($env:COMPUTERNAME)
ComputerName: xxxxxxx
VolumeType Mount CapacityGB VolumeStatus Encryption KeyProtector AutoUnlock Protection
Point Percentage Enabled Status
---------- ----- ---------- ------------ ---------- ------------ ---------- ----------
OperatingSystem C: 237.69 FullyDecrypted 0 {} Off
now, I insert this same function into a PSF file and call it like this;
$FF = Get-BitlockerEncryptionStatus $ComputerName
but the FF variable contains only C:, which is my MountPoint.
I honestly do not understand why the function's behavior differs when called as is or into some GUI we have.
Any hint/advise/idea that could help?
Thanks!