Powershell to Set-CalendarProcessing

Hi all!

I have a list of 65 user names that I need to add to the Resource In-Policy Requests tab in Exchange for 15 different Conference Rooms.
I have all the user names in a csv called USERS.csv under the heading ALIAS
What I would like to do is user Exchange Powershell to call the CSV and add the permissions

I tried this: Set-CalendarProcessing "NAME OF CONFERENCE ROOM" -BookinPolicy "Username1","Username2","Username3","Username4","Username5"
It did nothing, no error no result!

Can I do something similar to this:  Get-Content c:\users.csv | Set-CalendarProcessing "NAME OF CONFERENCE ROOM" -BookinPolicy  ??
GAC 2018Systems AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
import-csv -path c:\users.csv  | % { Set-CalendarProcessing -Identity "NAME OF CONFERENCE ROOM" -AutomateProcessing AutoAccept -BookInPolicy $_.alias -AllBookInPolicy $false }
or as a tool
function Set-MyCalendarProcessing
{
  <#
      .SYNOPSIS
      Describe purpose of "Set-MyCalendarProcessing" in 1-2 sentences.

      .DESCRIPTION
      Add a more complete description of what the function does.

      .PARAMETER InputObject
      Describe parameter -InputObject.

      .EXAMPLE
      Set-MyCalendarProcessing -InputObject Value
      Describe what this call does

      .NOTES
      Place additional notes here.

      .LINK
      URLs to related sites
      The first link is opened by Get-Help -Online Set-MyCalendarProcessing

      .INPUTS
      List of input types that are accepted by this function.

      .OUTPUTS
      List of output types produced by this function.
  #>


  param
  (
    [Parameter(Mandatory = $true, ValueFromPipeline = $true, HelpMessage = 'Data to process')]
    [string] $InputObject
  )
  process
  {
    Set-CalendarProcessing -Identity 'NAME OF CONFERENCE ROOM' -AutomateProcessing AutoAccept -BookInPolicy $InputObject.alias -AllBookInPolicy $false 
  }
}
$csvpath = Read-Host -Prompt 'Input the Filename and Path of the CSV to Process'
if ( Test-Path -Path $csvpath)
{
  Write-Output -InputObject ('Processing')
  Import-Csv -Path $csvpath  | Set-MyCalendarProcessing
}
else 
{
  Write-Output -InputObject ('File Not Found:{0}' -f $csvpath)
}

Open in new window

0
timgreen7077Exchange EngineerCommented:
If you entered those cmdlets and you got no error, then the changes were most likely successful. Powershell doesn't normally give a confirmation of success. If it would have failed you would have got an error, but by you not getting an error it most likely was successful. Look to verify if it was successful or not.
0
GAC 2018Systems AdministratorAuthor Commented:
Thank you for your quick response!  I ran the Import-csv command, it took about 5 minutes but only added one person from the list.  It was a random name in the middle of the list.
Any idea?
0
How the Cloud Can Help You as an MSSP

Today, every Managed Security Service Provider (MSSP) needs a platform to deliver effective and efficient security-as-a-service to their customers. Scale, elasticity and profitability are a few of the many features that a Cloud platform offers. Register today to learn more!

GAC 2018Systems AdministratorAuthor Commented:
Thanks Tim!
I didn't get an error and the perms weren't applied.  I gave it about 30 mins for 65 updates!
0
timgreen7077Exchange EngineerCommented:
I tried this: Set-CalendarProcessing "NAME OF CONFERENCE ROOM" -BookinPolicy "Username1","Username2","Username3","Username4","Username5"

This should have worked. This is the cmdlets you mentioned you entered. Does this not work for you or you just want to use a csv file?
0
GAC 2018Systems AdministratorAuthor Commented:
That was what I ran that sat there doing nothing, and yes, if possible, I would like to use the CSV I have setup
0
timgreen7077Exchange EngineerCommented:
Try the following:


$userlist = Import-Csv C:\temp\filename.csv
foreach ($user in $userlist){
set-CalendarProcessing "conf room" -BookinPolicy $user.alias
}

Use an excel csv file instead of notepad, and make sure the column name is alias as you mentioned
If this fails also try @David Johnson
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GAC 2018Systems AdministratorAuthor Commented:
I feel like I'm real close, I'm just doing something stupid!  See the attached screen shot, please
PS-ERROR-MSG.jpg
0
timgreen7077Exchange EngineerCommented:
Copy and paste it as you see it. dont add it all on 1 line
0
timgreen7077Exchange EngineerCommented:
copy to notepad or word and make your changes and then paste into exchange shell.
0
GAC 2018Systems AdministratorAuthor Commented:
Hey Dude!  First of all thank you for your patience with my ignorance, you'll get a very good rating when we're done!

ok  so I have this:

$userlist = Import-Csv C:\temp\filename.csv
 foreach ($user in $userlist){
 set-CalendarProcessing "conf room" -BookinPolicy $user.alias
 }

Are you saying, after replacing "filename" and "Conf Room" with the real names, I should be able to take all of that and paste it into PS?
That sounded wrong to me so I ran the first line to import the csv then tried to manipulate the rest in the set command. but got no where!
Would it be possible to type out the command just as I need to paste it into PowerShell, put into a word document and attach it?
0
timgreen7077Exchange EngineerCommented:
this is the syntax

$userlist = Import-Csv C:\temp\filename.csv
foreach ($user in $userlist){
set-CalendarProcessing "conf room" -BookinPolicy $user.alias
}

yes, just add the correct filename of your csv and the correct conf room name.
0
David Johnson, CD, MVPOwnerCommented:
if you want to post it all on one line use semi-colons to separate the lines
$userlist = Import-Csv C:\temp\filename.csv; foreach ($user in $userlist){  set-CalendarProcessing "conf room" -BookinPolicy $user.alias  }

Open in new window

0
GAC 2018Systems AdministratorAuthor Commented:
Ok, that seemed to work, without error, EXCEPT, it only added the last name in the list.  Is the format in my csv wrong?  It looks like this:

alias
User1
User2
User3

Down to User63.  #63 was added but no one else
0
David Johnson, CD, MVPOwnerCommented:
$userlist = Import-Csv C:\temp\filename.csv; foreach ($user in $userlist){  write-output ("Processing $user.alias");set-CalendarProcessing "conf room" -BookinPolicy $user.alias  }

Open in new window

0
GAC 2018Systems AdministratorAuthor Commented:
The same result.  What's happening is User1 gets added, when User2 gets added, it removes User1, when User3 gets added it removes User2 and so on
0
David Johnson, CD, MVPOwnerCommented:
ok so it's looking for a list
Import-Csv C:\temp\filename.csv | set-CalendarProcessing "conf room" -BookinPolicy $_.alias  

Open in new window

0
GAC 2018Systems AdministratorAuthor Commented:
Is this the whole thing?
Import-Csv C:\temp\filename.csv | set-CalendarProcessing "conf room" -BookinPolicy $_.alias
0
David Johnson, CD, MVPOwnerCommented:
yes that is the whole thing
0
GAC 2018Systems AdministratorAuthor Commented:
It didn't like that!  I attached the error (I removed the user name from the picture)
Error.png
0
David Johnson, CD, MVPOwnerCommented:
try this
$users = Import-Csv C:\temp\filename.csv ; set-CalendarProcessing "conf room" -BookinPolicy $users.alias
Report Comment

Open in new window

0
GAC 2018Systems AdministratorAuthor Commented:
It only took a second to run, there were no errors but it didn't add anyone...
I'm sorry to be such a P.I.T.A.
0
David Johnson, CD, MVPOwnerCommented:
did you run 'Get-CalendarProcessing -Identity "Room 212" | Format-List" to check?
0
GAC 2018Systems AdministratorAuthor Commented:
Originally, no.  I just looked at it in the console.  I just ran it and attached the results...BookInPolicy:  { }
Error2.jpg
0
FOXActive Directory/Exchange EngineerCommented:
GAC,
The users in your list- are you listing their default email address or their display names?  if it is a display name you MUST put it in quotes as there is spacing

'Doe, John'
'Jane, Mary'
0
GAC 2018Systems AdministratorAuthor Commented:
I am using their "User Name", it is their employee ID Number.  I can try it with their display name in quotes.
0
FOXActive Directory/Exchange EngineerCommented:
Use either their default email address or their displayname from Exchange
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.