This page contains a number of PowerShell commands that may be helpful during troubleshooting
File Information
Run the following to get information about a file, including version information for libraries and executables:
Get-Item YourFilename | Format-List
To just get the version information you can also do the following:
(Get-Item YourFilename).VersionInfo
Event Log
Run this to get the list of entries in the Application log (note that each entry has an index number which you will need to refer to if you want more information):
Get-EventLog -LogName Application
Run this to get the detail of a particular entry, formatting the output as a list:
Get-EventLog -LogName Application -Index SomeEntryNumber | Format-List
.NET Framework Interaction
Accessing a static member involves putting the class name in square brackets and using "::" before the member name, for example to get the System.Environment.MachineName property:
[System.Environment]::MachineName
Creating an instance of an object involves using New-Object and passing the type and any constructor arguments, for example to create a System.Version object using the constructor that takes a string and put it into a variable:
$instance = New-Object -TypeName System.Version -ArgumentList "1.2.3.4"
SQL Commands
To run SQL commands you must have the "SqlServer" PowerShell module installed (this used to be included with SQL Server Management Studio but since v17.0 it is a separate install).
To download and install the module run the following command: (note if you get an error that there is a previous version installed then you may need to add the "-AllowClobber" argument to overwrite your old version)
Install-Module -Name SqlServer
After you have the module installed you can run SQL commands as follows:
Invoke-Sqlcmd -ServerInstance YourSQLServerHost -Database ImmixCloud -Query "select * from Prefs"
See the SqlServer module documentation for help with all other cmdlets.
Comments
0 comments
Please sign in to leave a comment.