The past few weeks have been about updating some of my modules such as PoshWSUS and now PoshRSJob. With PoshRSJob, I spent a lot of the time focused on improving the PowerShell V2 support by fixing some bugs that had been reported but I also took on a request to provide support for the module to run on Nano server.
Originally, I used Add-Type to compile and load some C# code to provide the classes that the module will use. Unfortunately, Nano server doesn’t have all of the cmdlets available that we know and love and includes Add-Type. I took one approach by using reflection to build out the classes and while this worked outside of Nano, it ultimately didn’t really…yet. I didn’t want to spend a lot of time on that just yet, so I decided to build a dll that would get loaded with the module to create the classes. After fixing that, I had to fix a spot where the runspace.ApartmentState was set to STA to support UIs as Nano doesn’t appear to have an ApartmentState property available to set.
The release notes is available below along with the link to the GitHub page where you can download the module or help contribute if you want!
- Fixed Issue #64 (HadErrors in PoshRS.PowerShell.RSJob throws errors in PowerShell V2)
- Fixed Issue #67 (Converted Add-Type code for C# classes to be created via Reflection for Nano server support) <- Created custom dll
- Fixed Issue #61 (Receive-RSJob not allowing -Job parameter input)
- Fixed Issue #63 (Replaced Global variables with Script scope)
- Fixed Issue #66 (Parameters don’t work with PowerShell V2)
- Fixed Issue #65 (Bug with v2 variable substitution – single-quoted strings get $var references replaced)
- Fixed Issue #68 (ApartmentState Does Not Exist in Nano)