I am developing a script which will be used to disable people's AD accounts in PowerShell as well as perform a lot of other functions.
I wanted the script to give the option of bulk mode or single mode. For example, as soon as you run the script, a parameter is enforced that asks if you want to run it in single mode or bulk mode. If bulk mode is selected, then it should load the function BULKmode which has already been defined and imports a csv.
If Single mode is selected, then it runs in single mode and selects the function Singlemode.
However the problem with PowerShell is that both parameters and functions go at the top of your script. I have tried both orders and the error I receive when I put the functions before the parameter is that there is
no such term as param
When i put the parameter first then it loads the parameter but then says
no such function
Below is a snippet
Param(
[Parameter (Mandatory=$true)]
[String]$PressYforBulkMode)
If ($PressYforBulkMode -eq "Y") {
Bulkmode
}
Else {
Singlemode
}
SamAccountName, among other things. The other parameter set takes a single filename (probably), among other things.