User Profile
PaulHarrison
Joined 7 years ago
User Widgets
Recent Discussions
Re: Powershell pssesion
PSSession: Exit-PSSession is used when you have used Enter-PSSession and want to end that session. To terminate the session you have created using New-PSSession use Remove-PSSession documented here: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/remove-pssession?view=powershell-7.3 You can remove the session the line after the invoke-command so that way you only try to remove it if it exists. Export: Your export is fine, just remove the pipe and everything after it. Extra bit: In your Get-LocalUser you use 'True' for a comparison. While it works because PowerShell automatically type casts, I recommend comparing with $True. PowerShell turning a boolean into a string: PS C:\> [string]$true True Determining the type of the property: PS C:\> $a = Get-LocalUser PS C:\> $a[0].Enabled False PS C:\> $a[0].Enabled.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Boolean System.ValueType I hope this helps. Have fun scipting. deepak410984Views0likes0Comments