what im trying do to, is get radarr to delete the movie requested from the web client after it moves it to the persons folder so if default path is D:\Movies\ then just log it, if it goes any where else other then D:\Movies\ then it will remove it from the Client.
looking for some guidance as i am completely new to powershell.
$movie_path = $env:radarr_moviefile_relativepath
$default_path = "D:\Movies\"
$RADARRIP="localhost"
$RADARRPORT="7878"
$RADARRAPIKEY="******"
$Logfile = "C:\Custom Scripts\Radarr.log"
Function LogWrite
{
Param ([string]$logstring)
Add-content $Logfile -value $logstring
}
if ($default_path == $movie_path)
{
LogWrite $movie_path $radarr_movie_id "added to server"
LogWrite " "
}
else
{
Invoke-WebRequest -Uri http://$RADARRIP:$RADARRPORT/api/movie/$radarr_movie_id" -X GET -H "X-Api-Key: $RADARRAPIKEY -k
LogWrite $movie_path $radarr_movie_id "added to server"
LogWrite $radarr_movie_id "selected movie from server"
Invoke-WebRequest -Uri http://$RADARRIP:$RADARRPORT/api/movie/$radarr_movie_id" -X DELETE -H "X-Api-Key: $RADARRAPIKEY -k
LogWrite $radarr_movie_id "movie removed from list"
LogWrite " "
}
Errors
+ Invoke-WebRequest -Uri http://$RADARRIP:$RADARRPORT/api/movie/$radarr ...
+ ~~~~~~~~~~
Variable reference is not valid. ':' was not followed by a valid variable name character. Consider using ${} to delimit the name.
At \\WIN-TQS12RTGKSQ\Custom Scripts\radarr.ps1:29 char:31
+ Invoke-WebRequest -Uri http://$RADARRIP:$RADARRPORT/api/movie/$radarr ...
+ ~~~~~~~~~~
Variable reference is not valid. ':' was not followed by a valid variable name character. Consider using ${} to delimit the name.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvalidVariableReferenceWithDrive