Questions tagged [powershell]
Apply this tag to questions related to any version of PowerShell.
18 questions
1vote
1answer
104views
How to deal with outdated PowerShell and Azure PS in Azure Automation?
Azure Automation is a service for running scripts in the cloud, intended for the automation of administration tasks. While using it, I came across strangely outdated technologies being used under the ...
2votes
1answer
205views
Best practice to avoid unintentional side-effects in powershell-scripts
I recently wrote a small PowerShell script to clean a Visual Studio solution. It's used by a small team of 5 persons on a regular basis. I built it in PowershellISE (GUI client) and it works great, ...
3votes
1answer
919views
What are the best practices to design a "verbose" mode in command line scripts?
To improve my command lines scripts, I want to add some optional console output, mainly for logging purposes. In my PowerShell modules, I use Write-Verbose for this (but it should be clear this isn't ...
0votes
1answer
157views
Refactoring powershell codebase to support multiple environments
I come from a Java background, but now I'm supporting a PowerShell code base. In the PowerShell code base there are multiple modules that were written against a certain Azure environment. Now, we ...
3votes
0answers
682views
Enum versus ValidateSet
Currently, in my PowerShell scripts I am using [ValidateSet()] in my functions in order to limit the options for user input. Now I discovered the Enum as an alternative. I have read a couple of blogs ...
4votes
1answer
305views
PowerShell performance when running Excel macros
I run on a daily basis a set of VBA-rich Excel files. Most of them include MS Office application cross-talk, but also employ third-party applications and MySQL. Due to the fact of running those files ...
2votes
2answers
569views
Should powershell be used to develop a whole application?
We are automating the testing on an Web ERP solution (Dynamics) through a tool (RSAT, which uses selenium) provided by the developer of the ERP (Microsoft). The RSAT has a list of instructions to do ...
2votes
1answer
1kviews
How to convert a powershell script to opensource `.exe`?
To make an installation of opensource software for the Windows platform single click, I am trying to convert the setup.ps1 into a setup.exe file. (To make a powershell script executable in a single (...
2votes
1answer
166views
Custom object formatting caveats as to not confuse end users
Default display of objects in the Windows PowerShell console In PowerShell you have format.ps1xml documents. These are used to simplify what and how object data is shown to the end user. A simple ...
0votes
0answers
58views
Typical Practice for external application config
I have a C# cmdlet(1) that uses "ConfigurationManager.AppSettings" to get database connection strings necessary for some stored procedures used in the cmdlet(1). If another application instantiates an ...
7votes
2answers
18kviews
Correct way to initialize variables in PowerShell
Is there a preferred practice around initialising variables which are first defined within a branch of code, or is this purely subjective / personal preference? i.e. there are multiple ways this can ...
1vote
0answers
98views
Continous integration of only MyCompanies nuget packages
I am trying to do a nightly package integration with one of our projects that consumes 6 other internal teams’ -PreRelease packages. Background Info We have our own internal ProGet Server that ...
-1votes
1answer
377views
How to license (PowerShell) GUI Projects [duplicate]
After almost 2 years learning how to code (in Powershell) and some help at Stackoverflow from time to time, I'm now finally on my way to release my first GUI project. I intend to release the compiled ...
1vote
1answer
300views
Should Write-Debug statements be left in production PowerShell code?
This is one of my functions I have in a module: Function Get-DatabaseUser { [CmdletBinding()] Param() Write-Verbose 'Getting database...' $Database = Get-Database Write-Debug('...
0votes
1answer
210views
Unix way of filtering/mapping/mapcatting records via the pipeline?
At home I use Linux and have for more than a decade. At work we use Windows and so I find PowerShell more familiar. I am a Linux/Unix fanboy at heart, but I've had greater success grokking the ...