Page 1 of 1

Powershell calls

PostPosted: Thu Feb 17, 2011 4:18 am
by fixitchris
  Code:
$req = [System.Net.WebRequest]::Create("http://localhost:23423/rest/application");
$req.Method ="GET";
$req.ContentLength = 0;
$resp = $req.GetResponse();
$reader = new-object System.IO.StreamReader($resp.GetResponseStream());
$reader.ReadToEnd();

Re: Powershell calls

PostPosted: Sat Jul 30, 2011 3:55 pm
by PK500
FORCE REFRESH

$req = [System.Net.WebRequest]::Create("http://localhost:23423/rest/action");
$req.Method ="POST";
$req.ContentType = "text/xml";
$Params = "<action><name>forceLibraryRefresh</name></action>";
$req.ContentLength = $Params.Length;
$stOut = new-object System.IO.StreamWriter($req.GetRequestStream());
$stOut.Write($Params);
$stOut.Close();
$resp = $req.GetResponse();
$reader = new-object System.IO.StreamReader($resp.GetResponseStream());
$reader.ReadToEnd();

------------
Windows7
1. Save to script as C:/bat/Refresh.ps1 file
2. Start All programs, Accessorie - Power shell
3. set-executionpolicy remotesigned (I should setup low security)
4. close it
5. Create bat file
6. Insert line: cmd /c start powershell -noninteractive c:\\bat\\Refresh.ps1"
7. Close

Serviio is very nice! Thank you