Download PowerShell Command Line Examples

yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

PowerShell Command Line Examples
Simplest form
C:\TEMP\Collector-Lansweeper.ps1 "C:\TEMP\" "SERVER01" "LansweeperDB"
Complete form
C:\TEMP\Collector-Lansweeper.ps1 -OutputFilePath "C:\TEMP\" -ServerName "SERVER01"
-DatabaseName "LansweeperDB" -IntegratedSecurity -ProgressDisplay -ProgressIncrementValue 500
PowerShell Command Line Parameters Described
Parameter Name
C:\ TEMP \
Get-Help .\Collector-Lansweeper.ps1
Script name in current folder.
Name identifying the folder location where
the generated file will be written. The value
must be a fully qualified folder name. The
name of the file to be created will be
generated by the PowerShell script and take
the form “lsw_ps_MM_DD_YYYY
The name of the server containing the
Lansweeper database.
The name of the Lansweeper Database.
If this parameter is included the script will
attempt to connect to the SQL Server
automatically using the current users Domain
credentials. If this value is not supplied the
script will prompt the user to supply valid SQL
Server credentials to proceed.
If this parameter is included, the command
window will include a progress activity
Specifies the number of rows written between
progress display updates. Default value is
For additional command line help use the
PowerShell Get-Help cmdlet.
Script Requirements
The first three parameters are required, all other parameters are optional. If the required parameters are not
provided on the PowerShell command line when the script is run the user will be prompted to provide them. If the
parameters are entered in the order displayed in the example the “Parameter Name” labels may be omitted. If
they will be entered in a different order or if only specific parameters are included the “Parameter Name” must
accompany the supplied value (ex. –OutputFilePath “C:\ TEMP \” or –IntegratedSecurity). The individual running
the script or the UserName/Password supplied during execution of the script must have sufficient READ permission
for the script to successfully collect the required information from the Database.
Also, it may be necessary to enable PowerShell script execution. If you receive a warning when executing the
script indicating you do not have permission to run the script on this machine you can try changing the script
execution policy. To change the execution policy, from the PowerShell command prompt type the following
command then press Enter
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
When the script is run a connection will be made to the Lansweeper Database to retrieve the necessary data. If
the IntegratedSecurity parameter is provided the user must have a minimum of READ permission to access the
data, otherwise, the IntegratedSecurity parameter should be omitted and a SQL Server UserName/Password
prompt will be presented. Once the credentials have been accepted the script will begin collecting the data and
creating the XML export file. If the “ProgressDisplay” parameter has been included, as the data is collected and
written the PowerShell command window will display current progress information. If the “ProgressDisplay”
parameter is not supplied then only minimal progress information will appear. If no errors are encountered the
script will indicate completion once the file has been created. If any errors occur during the script run they will
also be reported in the command window.
Author Information
Author: Inviso Corporation
Support Email: [email protected]