Screenconnect commandline: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Enable Remote Execution | ==Enable Remote Execution== | ||
<syntaxhighlight lang="powershell" line='line'>Set-ExecutionPolicy RemoteSigned</syntaxhighlight> | <syntaxhighlight lang="powershell" line='line'>Set-ExecutionPolicy RemoteSigned</syntaxhighlight> | ||
Show Processes Names Like sam* and Filter for name only | ==Show Processes Names Like sam* and Filter for name only== | ||
<syntaxhighlight lang="powershell" line="line">Get-Process sam* | Select-object name</syntaxhighlight> | <syntaxhighlight lang="powershell" line="line">Get-Process sam* | Select-object name</syntaxhighlight> | ||
Test if Service is Running | ==Test if Service is Running== | ||
<syntaxhighlight lang="powershell" line="line">(Get-Service -Name 'Spooler').Status -eq 'Running'</syntaxhighlight> | <syntaxhighlight lang="powershell" line="line">(Get-Service -Name 'Spooler').Status -eq 'Running'</syntaxhighlight> | ||
Show Drives and Space Usage | ==Show Drives and Space Usage== | ||
<syntaxhighlight lang="powershell" line="line">get-psdrive -psprovider filesystem</syntaxhighlight> | <syntaxhighlight lang="powershell" line="line">get-psdrive -psprovider filesystem</syntaxhighlight> | ||
Create a Desktop shortcut to a folder | ==Create a Desktop shortcut to a folder== | ||
<syntaxhighlight lang="powershell" line="line"> | <syntaxhighlight lang="powershell" line="line"> | ||
$TargetFile = "C:\scan\" | $TargetFile = "C:\scan\" |
Revision as of 14:19, 13 March 2020
Enable Remote Execution
Set-ExecutionPolicy RemoteSigned
Show Processes Names Like sam* and Filter for name only
Get-Process sam* | Select-object name
Test if Service is Running
(Get-Service -Name 'Spooler').Status -eq 'Running'
Show Drives and Space Usage
get-psdrive -psprovider filesystem
Create a Desktop shortcut to a folder
$TargetFile = "C:\scan\"
$ShortcutFile = "$env:Public\Desktop\folder.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
$Shortcut.TargetPath = $TargetFile
$Shortcut.Save()