Reputation: 1
How can i combine below 3 powershell scripts into one single script?
.
Get-content C:\TEMP\Users1.txt |get-aduser |set-aduser -enabled $false
Get-content C:\TEMP\user1.txt | Set-Mailbox -HiddenFromAddressListsEnabled $true
Get-content C:\temp\users1.txt | set-CASMailbox -ActiveSyncEnabled:$False
Export-Csv "DisableU-$(Get-Date -f yyyyMMdd_HHmm).csv" -NoType
Kindly guide me. Thanks in advance.
Upvotes: 0
Views: 236
Reputation: 203
Just put them into any *.ps1 file and run from console by providing the full path to the script. If you are in the script directory just run:
./Script.ps1
You might also need to set proper Execution Policy. This is the separated topic but just for now you can set it to unrestricted.
PS> Set-ExecutionPolicy Unrestricted -Force
But please read about Execution Policies.
Upvotes: 1