I've a need to change the "DisableFormatUpdates" session state value within my powershell. I've figured out how to retrieve the initial session state:
[System.Management.Automation.Runspaces.Runspace]::DefaultRunspace.InitialSessionState
DisableFormatUpdates : True
Which returns the value as expected.
However I don't understand how to set this value to False, so that I can complete an import of a module. It appears that the runspace is being set by SMA, but I need to reset this value for a module that we're required to load.
Any help would be appreciated, as I'm definitely out of my element on setting this within the context of my powershell workflow.
Create the sessionstate object and then set the property to $true
or $false
PS C:\> $sessionstate = [system.management.automation.runspaces.initialsessionstate]::CreateDefault()
PS C:\> $sessionstate.DisableFormatUpdates = $true
PS C:\> $sessionstate.DisableFormatUpdates
True
PS C:\> $sessionstate.DisableFormatUpdates = $false
PS C:\> $sessionstate.DisableFormatUpdates
False