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?
 
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
 
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
How do you know if your security is working?

Protecting your business doesn’t have to mean sifting through endless alerts and notifications. With WatchGuard Total Security Suite, you can feel confident that your business is secure, meaning you can get back to the things that have been sitting on your to-do list.

 
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
 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.