Friday, 20 July 2012
Connect to Remote Machine using Powershell
To connect to remote machine using PowerShell. WinRM (Windows Remote Management) service needs to be in started mode on the remote computer.
Then, run the following command on remote computer: WinRM quickconfig
Follow the steps displayed in command prompt to receive requests and remote management. Now the remote machine is ready to be accessed using powershell from any other computer.
Type following command in Powershell to access the remote machine:
-> Enter-PSSession ComputerName
Get Status of Service on a Remote Machine - PowerShell Command
Get-Service ServiceName -computername remotecompname | Select-object -Property Name,Status, MachineName
Get all services which are running - PowerShell Command
Get-Service | Where {$_.Status -eq "running"}
What are Cmdlets
Cmdlets are specialized commands in the PowerShell environment that implement specific functions. These are the native commands in the PowerShell stack. Cmdlets follow a <verb>-<noun> naming pattern, such as Get-ChildItem
Display Message with Timer - VBScript
Following Script displays a message for 60seconds OR until user clicks OK.
a = "WSS 4.1 is already installed, Exiting WSS 5.0 Installation"
Set sh = CreateObject("WScript.Shell")
sh.Popup a,60, ""
Thursday, 19 July 2012
Wednesday, 18 July 2012
Check if Registry Exists - VBScript
Const HKEY_CURRENT_USER = &H80000002
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{039694F1-2108-4B3E-8575-85C245210F94}"
strValueName = "DisplayName"
objRegistry.GetStringValue HKEY_CURRENT_USER,strKeyPath,strValueName,StrValue
If IsNull(StrValue) Then
Wscript.Echo "The registry key does not exist."
Else
Wscript.Echo "The registry key exists."
End If
Subscribe to:
Comments (Atom)
