I am trying to run a logon script to capture the logged on user network drive map file system. I run the command locally on computer and it works fine. I get the computername and file system of network drive.
if i run it as a login script I get the computer name but never the file system. I have even tried to put a start-sleep for 2 minutes. I still do not get it.
I am not sure what i am doing wrong
$system= Get-WmiObject Win32_ComputerSystem -ComputerName localhost| Select-Object Name $localdisk=Get-WMIObject Win32_Logicaldisk -filter "deviceid='M:'" -ComputerName localhost $Object = New-Object PSObject -Property @{ ComputerName = $system.Name 'M drive' = $localdisk.FileSystem } $Object | Export-Csv -NoTypeInformation \\networkdrivelocation\"$env:computername".csv