Brian Ellis1709152899 Posted November 23, 2013 Share Posted November 23, 2013 I would like to disable all published applications in a folder using PowerShell. I can use this command to disable a specific application: Disable-XAApplication "applicaiton name" And I can use this command to list all applications in the Applications/Test folder: Get-XAApplication -FolderPath Applications/Test How can I disable all applications in the Applications/Test folder using PowerShell? Thanks in advance. Brian Link to comment
0 Shaun Ritchie Posted November 26, 2013 Share Posted November 26, 2013 This should do it $apps = Get-XAApplication -FolderPath Applications/Test foreach ($app in $apps) { Disable-XAApplication -BrowserName $app.browsername Set-XAApplication -BrowserName $app.browsername -Enabled $false -HideWhenDisabled $true } ----------Shaun Ritchiewww.shaunritchie.co.ukwww.twitter.com/shaunritchie_uk 1 Link to comment
0 Brian Ellis1709152899 Posted November 23, 2013 Author Share Posted November 23, 2013 I think it should be something like this: foreach ($BrowserName in Get-XAApplication -FolderPath Applications/Test -Enabled $true) { Disable-XAApplication } But the Get-XAApplication command does not grab the -Enabled state for me. Link to comment
0 Shaun Ritchie Posted November 25, 2013 Share Posted November 25, 2013 Try this. $apps = Get-XAApplication -FolderPath Applications/Test foreach ($app in $apps) { Disable-XAApplication -BrowserName $app.browsername } ---------- Shaun Ritchie www.shaunritchie.co.uk www.twitter.com/shaunritchie_uk Link to comment
0 Brian Ellis1709152899 Posted November 25, 2013 Author Share Posted November 25, 2013 Shaun, That is perfect. One more question. Is there a way I can hide the application when I disable it? I usually use this command: Set-XAApplication "test" -Enabled $false -HideWhenDisabled $true Is there a way I can incorporate the "hide" command into your script? Link to comment
0 Brian Ellis1709152899 Posted November 26, 2013 Author Share Posted November 26, 2013 Thank you very much Shaun! That script works great. Link to comment
0 Abraham Cure Jr. Posted November 6, 2014 Share Posted November 6, 2014 Hi, I have a similar question, but the applications are mixed in different folders and I don't want some applications in the same folders disabled. What I am trying to do is disable and hide, applications that have not been used in a year. I used Report Center to get a list of applications that have not been used in a year or more. I would like to disable and hide that list of applications, which are in different folders mixed in with applications that I don't want to disable and hide. I can make a txt for csv file with a list of the unused applications, can I use that list to disable and hide with out worrying about the Folder path? I can also get folder Path in CSV file. Thanks, AC Link to comment
0 Shaun Ritchie Posted November 7, 2014 Share Posted November 7, 2014 Try this $Apps = Get-Content C:\applist.txt ForEach ($App in $Apps) { Disable-XAApplication -BrowserName $App.browsername Set-XAApplication -BrowserName $App.browsername -Enabled $False -HideWhenDisabled $True } Create a file in C:\ called applist.txt and seperate each application name on separate lines. Please test first. ----------Shaun Ritchiewww.shaunritchie.co.ukwww.twitter.com/shaunritchie_uk Link to comment
0 Abraham Cure Jr. Posted November 7, 2014 Share Posted November 7, 2014 Hi Shaun, Thanks for the reply but I am getting errors: Cannot validate argument on parameter 'BrowserName' I don't think it has a way of know with that parameter is by just a app name in a txt file? The previous example which has a Get-XXApplication -FolderPath so it will have the BrowserName Parameter. How can we get that parameter with the script that uses the txt file? Thanks Link to comment
0 Abraham Cure Jr. Posted November 7, 2014 Share Posted November 7, 2014 Hi, Replacing BrowserName with $app worked. Thanks Link to comment
0 Shaun Ritchie Posted November 10, 2014 Share Posted November 10, 2014 Cool. Forgot to remove that from the copy and paste. ---------- Shaun Ritchiewww.shaunritchie.co.ukwww.twitter.com/shaunritchie_uk Link to comment
0 Mdell150 Posted April 10, 2017 Share Posted April 10, 2017 A little late, but this is what I use for this: get-xaapplication -workergroup "target worgergroup" | Where-Object {$_.Folderpath -eq "folder"} | Set-XAApplication -passthru -enabled $false -hidewhendisabled $True Link to comment
0 ThodianPalliyalil Srinivas Posted October 20, 2021 Share Posted October 20, 2021 The script works when I loop through it asks for the input arguments on the console Link to comment
Question
Brian Ellis1709152899
I would like to disable all published applications in a folder using PowerShell. I can use this command to disable a specific application:
Disable-XAApplication "applicaiton name"
And I can use this command to list all applications in the Applications/Test folder:
Get-XAApplication -FolderPath Applications/Test
How can I disable all applications in the Applications/Test folder using PowerShell?
Thanks in advance. Brian
Link to comment
12 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now