Forum Discussion

jacobronde's avatar
jacobronde
Copper Contributor
Jan 14, 2022

Set-Place

Hi,
I try to add information to our meeting rooms, by using Set-Place
We are using a hybrid setup and therefore only using Set-Place to set a few data.

this Script worked for me last week but now I get an "Internal server error" when I try to run it.
Can anybody see whats going wrong?

 

--------------------------Script Begins---------------------------------------

#User credentials
$UPN = read-host -Prompt "Initialer"
$C = Get-Credential -UserName "$UPN-adm" -Message "Password please"
Connect-ExchangeOnline

 

#Create folder to csv export if not already created
New-Item -Path "c:\" -Name "Powershell csv" -ItemType "directory" -Credential $C

 

#Input Roomlist name in variable ADgroup
$ADgroup = "RL_EOP_ep-galgebakken"
Get-ADGroupMember -Identity "$ADgroup" | Select SamAccountName | Export-Csv -Path "C:\Powershell csv\Roomfinder.csv" -Force

 

#Information sent to room this is for rooms at Knud Højgaards Vej 7
#$City = "Søborg"
#$StreetAddress = "Knud Højgaards Vej 7"
#$PostalCode = "2860"
#$Contry = "DK"

$City = ""
$StreetAddress = ""
$PostalCode = ""
$Country = ""

 

#Command to transfer location to rooms
Import-Csv "C:\Powershell csv\Roomfinder.csv" | foreach {Set-ADUser $_.SamAccountName.trim() -City "$City" -StreetAddress "$StreetAddress" -PostalCode "$PostalCode" -Country "$Country" -Credential $C}

 

#Command to give each room an Atributte
Import-Csv "C:\Powershell csv\Roomfinder.csv" | foreach {Get-ADUser $_.SamAccountName.trim() | Select USerPrincipalName}


#$Place is the UserPrincipalName for a single output from the command above.
#If wheelchair friendly remove # and "" from line 38 and # from line 45
$Place = "Email address removed"
$Capacity = "12"
$Building = ""
$Floor = ""
$Audio = ""
$Display = "Clickshare Barco"
$Video = "Clickshare Barco"
#$WheelChair = "$true"
Set-place $Place -Capacity $Capacity
Set-place $Place -Building "$Building"
Set-place $Place -floor "$Floor"
Set-place $Place -AudioDeviceName "$Audio"
Set-place $Place -DisplayDeviceName "$Display"
Set-place $Place -VideoDeviceName "$Video"
#Set-place $Place -IsWheelChairAccessible $WheelChair

 

#show details from every room in chosen roomlist When rooms are synced (30 min.)
Import-Csv "C:\Powershell csv\Roomfinder.csv" | foreach {Get-Place $_.SamAccountName.trim() | Format-List}

 

---------------------Script End----------------------------------------

  • Animesh Joshi's avatar
    Animesh Joshi
    Brass Contributor
    Does it tell you which script line it throws the error on?
    After it errors out, can you post the output of the following:
    $error[0] | fl * -force

Resources