Set-Place

%3CLINGO-SUB%20id%3D%22lingo-sub-3061578%22%20slang%3D%22en-US%22%3ESet-Place%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3061578%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3CBR%20%2F%3EI%20try%20to%20add%20information%20to%20our%20meeting%20rooms%2C%20by%20using%20Set-Place%3CBR%20%2F%3EWe%20are%20using%20a%20hybrid%20setup%20and%20therefore%20only%20using%20Set-Place%20to%20set%20a%20few%20data.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3Ethis%20Script%20worked%20for%20me%20last%20week%20but%20now%20I%20get%20an%20%22Internal%20server%20error%22%20when%20I%20try%20to%20run%20it.%3CBR%20%2F%3ECan%20anybody%20see%20whats%20going%20wrong%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E--------------------------Script%20Begins---------------------------------------%3C%2FP%3E%3CP%3E%23User%20credentials%3CBR%20%2F%3E%24UPN%20%3D%20read-host%20-Prompt%20%22Initialer%22%3CBR%20%2F%3E%24C%20%3D%20Get-Credential%20-UserName%20%22%24UPN-adm%22%20-Message%20%22Password%20please%22%3CBR%20%2F%3EConnect-ExchangeOnline%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%23Create%20folder%20to%20csv%20export%20if%20not%20already%20created%3CBR%20%2F%3ENew-Item%20-Path%20%22c%3A%5C%22%20-Name%20%22Powershell%20csv%22%20-ItemType%20%22directory%22%20-Credential%20%24C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%23Input%20Roomlist%20name%20in%20variable%20ADgroup%3CBR%20%2F%3E%24ADgroup%20%3D%20%22RL_EOP_ep-galgebakken%22%3CBR%20%2F%3EGet-ADGroupMember%20-Identity%20%22%24ADgroup%22%20%7C%20Select%20SamAccountName%20%7C%20Export-Csv%20-Path%20%22C%3A%5CPowershell%20csv%5CRoomfinder.csv%22%20-Force%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%23Information%20sent%20to%20room%20this%20is%20for%20rooms%20at%20Knud%20H%C3%B8jgaards%20Vej%207%3CBR%20%2F%3E%23%24City%20%3D%20%22S%C3%B8borg%22%3CBR%20%2F%3E%23%24StreetAddress%20%3D%20%22Knud%20H%C3%B8jgaards%20Vej%207%22%3CBR%20%2F%3E%23%24PostalCode%20%3D%20%222860%22%3CBR%20%2F%3E%23%24Contry%20%3D%20%22DK%22%3C%2FP%3E%3CP%3E%24City%20%3D%20%22%22%3CBR%20%2F%3E%24StreetAddress%20%3D%20%22%22%3CBR%20%2F%3E%24PostalCode%20%3D%20%22%22%3CBR%20%2F%3E%24Country%20%3D%20%22%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%23Command%20to%20transfer%20location%20to%20rooms%3CBR%20%2F%3EImport-Csv%20%22C%3A%5CPowershell%20csv%5CRoomfinder.csv%22%20%7C%20foreach%20%7BSet-ADUser%20%24_.SamAccountName.trim()%20-City%20%22%24City%22%20-StreetAddress%20%22%24StreetAddress%22%20-PostalCode%20%22%24PostalCode%22%20-Country%20%22%24Country%22%20-Credential%20%24C%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%23Command%20to%20give%20each%20room%20an%20Atributte%3CBR%20%2F%3EImport-Csv%20%22C%3A%5CPowershell%20csv%5CRoomfinder.csv%22%20%7C%20foreach%20%7BGet-ADUser%20%24_.SamAccountName.trim()%20%7C%20Select%20USerPrincipalName%7D%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%23%24Place%20is%20the%20UserPrincipalName%20for%20a%20single%20output%20from%20the%20command%20above.%3CBR%20%2F%3E%23If%20wheelchair%20friendly%20remove%20%23%20and%20%22%22%20from%20line%2038%20and%20%23%20from%20line%2045%3CBR%20%2F%3E%24Place%20%3D%20%22Email%20address%20removed%22%3CBR%20%2F%3E%24Capacity%20%3D%20%2212%22%3CBR%20%2F%3E%24Building%20%3D%20%22%22%3CBR%20%2F%3E%24Floor%20%3D%20%22%22%3CBR%20%2F%3E%24Audio%20%3D%20%22%22%3CBR%20%2F%3E%24Display%20%3D%20%22Clickshare%20Barco%22%3CBR%20%2F%3E%24Video%20%3D%20%22Clickshare%20Barco%22%3CBR%20%2F%3E%23%24WheelChair%20%3D%20%22%24true%22%3CBR%20%2F%3ESet-place%20%24Place%20-Capacity%20%24Capacity%3CBR%20%2F%3ESet-place%20%24Place%20-Building%20%22%24Building%22%3CBR%20%2F%3ESet-place%20%24Place%20-floor%20%22%24Floor%22%3CBR%20%2F%3ESet-place%20%24Place%20-AudioDeviceName%20%22%24Audio%22%3CBR%20%2F%3ESet-place%20%24Place%20-DisplayDeviceName%20%22%24Display%22%3CBR%20%2F%3ESet-place%20%24Place%20-VideoDeviceName%20%22%24Video%22%3CBR%20%2F%3E%23Set-place%20%24Place%20-IsWheelChairAccessible%20%24WheelChair%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%23show%20details%20from%20every%20room%20in%20chosen%20roomlist%20When%20rooms%20are%20synced%20(30%20min.)%3CBR%20%2F%3EImport-Csv%20%22C%3A%5CPowershell%20csv%5CRoomfinder.csv%22%20%7C%20foreach%20%7BGet-Place%20%24_.SamAccountName.trim()%20%7C%20Format-List%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E---------------------Script%20End----------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3061578%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New Contributor

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----------------------------------------

1 Reply
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