@if (@x)==(@y) @end /***** jscript comment ****** @echo off cscript //E:JScript //nologo "%~f0" "%~nx0" %* exit /b 0 @if (@x)==(@y) @end ****** end comment *********/ /* Value Button 0 OK 1 OK, Cancel 2 Abort, Ignore, Retry 3 Yes, No, Cancel 4 Yes, No 5 Retry, Cancel Value Icon 0 No Icon 16 Critical 32 Question 48 Exclamation 64 Information */ var icon = 64; var button = 0; var title = "Sample Title"; var message = "Sample Message"; var timeout = 30; var pressed_message = "button pressed"; var timeout_message = "timedout"; function runPopup(){ var wshShell = WScript.CreateObject("WScript.Shell"); var btn = wshShell.Popup(message, timeout, title, button + icon + 0x10000); /* Value Return Code 1 OK 2 Cancel 3 Abort 4 Retry 5 Ignore 6 Yes 7 No -1 None, message box was dismissed automatically (timeout) */ switch(btn) { // button pressed. case 1: WScript.Echo(pressed_message); break; // Timed out. case -1: WScript.Echo(timeout_message); break; } } runPopup();
Tag Archives: windows
vbs http download
Dim Hostname, fso, CurrentDirectory Set wshShell = Wscript.CreateObject("Wscript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") CurrentDirectory = fso.GetAbsolutePathName(".") Hostname = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%") WScript.Echo "HOSTNAME: " & Hostname HTTPDownload "http://example.com/" & Hostname & ".txt", CurrentDirectory Sub HTTPDownload(myURL, myPath) ' Standard housekeeping Dim i, objFile, objFSO, objHTTP, strFile Const ForReading = 1, ForWriting = 2, ForAppending = 8 ' Create a File System Object Set objFSO = CreateObject("Scripting.FileSystemObject") ' Check if the specified target file or folder exists, ' and build the fully qualified path of the target file If objFSO.FolderExists(myPath) Then strFile = objFSO.BuildPath(myPath, Mid(myURL, InStrRev(myURL, "/") + 1)) ElseIf objFSO.FolderExists(Left(myPath, InStrRev(myPath, "\") - 1)) Then strFile = myPath Else WScript.Echo "ERROR: Target folder not found." Exit Sub End If ' Create or open the target file Set objFile = objFSO.OpenTextFile(strFile, ForWriting, True) ' Create an HTTP object Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1") ' Download the specified URL objHTTP.Open "GET", myURL, False objHTTP.Send ' Write the downloaded byte stream to the target file For i = 1 To LenB(objHTTP.ResponseBody) objFile.Write Chr(AscB(MidB(objHTTP.ResponseBody, i, 1))) Next ' Close the target file objFile.Close() End Sub
RDP – Configuring License server manually
There might be situation when you want to configure License server on the RD Session Host or on the RD Virtualization Host manually since you do not have any RD Connection Broker in your environment. You have already configured RD Session Host server or Virtualization Host Server as required and now you want to configure the License server which is already installed and configured with licenses. All you are left to do is configure the License Server and the Licensing mode on the corresponding RD session Host or Virtualization Host servers.
Note: The following commands must be ran from an Administrative PowerShell prompt.
To configure the license server on RDSH/RDVH:
$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting $obj.SetSpecifiedLicenseServerList("License.contoso.com")
Note: “License” is the name of the License Server in the environment
To verify the license server configuration on RDSH/RDVH:
$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting $obj.GetSpecifiedLicenseServerList().SpecifiedLSList
To change the licensing mode on RDSH/RDVH:
$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting $obj.ChangeMode(value) - Value can be 2 - per Device, 4 - Per user
To validate the licensing mode on RDSH/RDVH:
$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting $obj.LicensingType $obj.LicensingName