Quantcast
Browsing all 121 articles
Browse latest View live

How to catch sql query error in powershell

I have a query like this in my PowerShell Scripttry{ $Query = "SELECT ID / 0 FROM Tables1" Invoke-Sqlcmd -Query $Query -ServerInstance $Global:Server -Database $Global:Database}catch {"error when...

View Article


How to ensure Export-Csv is in same column order?

I have the following PowerShell code that imports a csv (that has 35 column) and modifies the "Account" column. It's working as expected. However, when I export, it's adding it as the first column when...

View Article


Update Data flow connection details for a given Power BI report Dataset

I want get the Connection details against a Power BI report Dataset. Here, please note that my Datasource for Power Bi report Dataset is Dataflow.$PbiDataSourcesObject = (Get-PowerBIDatasource...

View Article

Managing "Cannot bind argument to parameter 'Path' because it is null

I have a powershell script that will move files containing certain "key words" to the corresponding folder listed in various .csv files. While I seem to have the mechanism down to move the files. I...

View Article

Looking for a list of service accounts that have read or write ability in...

I am looking for a list of service accounts that have read or write ability in AD.If all of the service accounts have that ability, then I might be looking for service accounts that query active...

View Article


PowerShell catch exception in Param() block

Param( [ValidateRange(21,90)] [int[]]$Age)How to catch exception when $age is out of range?

View Article

Image may be NSFW.
Clik here to view.

EXE silent installation

I have following PowerShell script to install application without user intervention:Start-Process -FilePath "C:\Temp\UpgradeClientInstaller\setup.exe" -ArgumentList "/S /v/qn"by giving /s in argument...

View Article

Invoke-Command with -credentials

I want to invoke a command on a remote server, I do not want to have to put in the password to run the script. I've tried encrypting the password and storing it in a txt file. $username =...

View Article


My PowerShell script only works when running from ISE

I can't post all of the script contenet, but the basic idea is that it downloads JSON and converts it to objects using the ConvertFrom-Json cmdlet. Some objects are filtered out, and the rest are...

View Article


PowerShell - Check if Java Application is running, if not - restart it....

I've had a good search around, but can't quite find what I'm looking for. We have Java applications running 24/7 on several remote machines which intermittently crashes (We think the application's devs...

View Article

Image may be NSFW.
Clik here to view.

I have installed SQL Server 2019 via PowerShell but I am not able to open...

I have installed SQL Server 2019 via PowerShell, the installation completed successfully, but I am not able to open SSMS (Microsoft SQL Server Management Studio). I have one Windows server with working...

View Article

NT service\SQLTELMETRY provided for NT service\SQLTELMETRY$XCLERAINST is...

While I was trying to install the 2019 MS SQL via PowerShell. I am getting the below error message.The following error occured: NT service\SQLTELMETRY provided for NT service\SQLTELMETRY$XCLERAINST is...

View Article

Image may be NSFW.
Clik here to view.

Need a powershell logic : If the particular service is running code have to...

I need a PowerShell logic based on windows services and Control panel Programs and Feature. Powershell code have to check whether the "SQL Server (XCELERAINST)" service is running. If the service...

View Article


How to execute a CMD file in remote computer

I am looking to execute a command in remote machine using invoke but the .cmd file will call for additional .vbs script. So i guess i may have to mention CScript if so how do i mention both cmd/c and...

View Article

How to verify version format in powershell script?

So I am trying to verify if a provided version number is valid or not in powershell with the following code:$ParsedVersion=''if ([System.Version]::TryParse("1.2.3.43", [ref]$ParsedVersion)) {...

View Article


Powershell - "Access to the path is denied" when attempting to redirect...

I'm trying to redirect console output from a TFS command to a file with the following command:witadmin listfields /collection:blahblah:8080/tfs/TPC > TFSfields.txtbut I get an error:"Access to the...

View Article

How to execute a CMD file in remote computer

I am looking to execute a command in remote machine using invoke but the .cmd file will call for additional .vbs script. So i guess i may have to mention CScript if so how do i mention both cmd/c and...

View Article


How to use powershell as native messaging host?

My requirement is to read the content from the file and send it to the chrome browser extension. I am using native messaging. I did all the configuration for native messaging but failed to send...

View Article

Powershell Get-Service detailed "DESCRIPTION" of the Windows Service

Is there a way to get the detailed "DESCRIPTION" of the Service? The below cmdlet can provide all of the properties of Windows Service including display name but it is not getting the...

View Article

Configuring "Do not forcefully unload the users registry at user logoff" in...

I need to write a PowerShell script that should configure the below settings of Group policy in all the machines.Gpedit.msc → Computer Configuration → Administrative Templates → System → User Profiles...

View Article
Browsing all 121 articles
Browse latest View live