Invoke-SQL not working when splatted

I feel like I’m missing something incredibly obvious here. When I run Invoke-Sqlcmd -InputFile “redacted” -ServerInstance “redacted” -Credential (Get-Credential) The query executes perfectly. However if I run $sqlArgs = @{ #Location of the SQL script InputFile = “redacted” #Server you want the script to run on ServerInstance = “redacted” #Prompt user for their username and […]

When running ‘update-ca-trust’ (or equivalent) on Linux from within a pwsh session, why do I need to exit pwsh and re-enter before Invoke-RestMethod (and similar) recognize the new trust?

Looking for someone with some insight into how pwsh handles this under the hood to explain why this would be necessary, and ultimately if there’s a way to update ca trust and stay in the same pwsh session. submitted by /u/fourierswager [link] [comments]

Get last working day of current month?

Snippit: $Date = (Get-Date) $lastday=(-1..-7 | ForEach-Object { (Get-Date $Date -day 1).AddDays($_) } | Where-Object DayOfWeek -notin ‘Saturday’, ‘Sunday’) | Select -First 1 $lastday=$lastday.tostring(“yyyy-MM-dd”) $today=(Get-Date).tostring(“yyyy-MM-dd”) if ($lastday -eq $today) The issue is that last day is giving me the LAST month’s last working day. I need the current month’s last working day so that one […]