7 ms·
I used to be a hardcore Windows dev but never figured out powershell. I actually ended up writing scripts in C# and had a utility to load and run it.
by rr808 2y ago
I used to be a hardcore Windows dev but never figured out powershell. I actually ended up writing scripts in C# and had a utility to load and run it.
- martinsnow 2y agoGood news. You can write C# that powershell will compile on the fly. It's so ingrained in Microsoft applications that even MSSQL Server will do it as well, if you want to go down that route.
- oblio 2y agoHow?
- martinsnow 2y agoExecuting C# in Powershell: https://blog.adamfurmanek.pl/2016/03/19/executing-c-code-using-powershell-script/index.html https://blog.adamfurmanek.pl/2016/03/19/executing-c-code-usi... Executing C# in SQL Server: https://learn.microsoft.com/en-us/sql/language-extensions/how-to/call-c-sharp-from-sql?view=sql-server-ver16 https://learn.microsoft.com/en-us/sql/language-extensions/ho... An anecdote: about 7 years ago I made an postal code lookup function for SQL server, that would parse a csv from the danish postal services, that was retrieved from a HTTP GET in T-SQL, then parsed with C# to get the city from a postal code. It was a project i did for fun at school.
- rqtwteye 2y agoThat's what they should have done. Have a C# interpreter with maybe a few extensions for shell stuff. Powershell is not a good .NET language and not a good shell. It's just a weird beast. A while ago I worked on a project to do pretty complex configuration on Windows machines. Everybody thought Powershell would be perfect for this. It turned into a complete nightmare with tons of oddities to work around. I myself barely can make sense of the code and I bet nobody else can. Next time I would do either Python or write the whole thing in C#.