Quantcast
Channel: PowerShell General
Browsing all 10624 articles
Browse latest View live

Simple ? on how to construct an output file with current date in it

Afternoon, I have a ps script I just crafted that will recursively delete BAK files from a parent and child folders of said parent. Works like a champ. I cannot seem to get the easy part of outputting...

View Article


SQL Query results to PowerShell Array.

Hi,First time I've posted on here so hi. I'm pretty new to SQL so sorry if this looks a little naff.I'm trying to query two tables. One has a username, associated with an ID, the other has a list of...

View Article


sql query to mysql

I have queried a database on the network and get the following into my variablePS C:\scripts> $aspent_on...

View Article

SQL Servers Service status

Hello everyone.Can anyone offer me some advice on how to check thru a list of servers to check their SQL server service status , started , stopped etc.I need to do this using SQL authentication as I...

View Article

Connect to SQL Compact Edition (CE) using PowerShell

Hello,I support an application that deploys an .sdf file. I would like to query/edit the contents of the file using PowerShell.I'll assume I'll need at least CE and the SQLPS module installed. I'm OK...

View Article


Results into array

Hello,I'm the below works fine but I'm trying to get the results into an array.Basically Write-Host $row.Item("Username") $row.Item("SizeMB"); gives me what I want on the screen but I need to get that...

View Article

Powershell error.....but it works sometimes !

Hi , hope someone can shed some light on what is wrong here.I have a script that captures SQL Server config details and saves them to SQL table. Stats collected by powershell. The script runs fine on...

View Article

powershell with excel

Hi,      i want import from sql server tables to Excel spread sheets.  For Example. Sql server Tables:1.emp2. orders. The above two tables need single excel sheet but different worksheets(sheet1,sheet2). 

View Article


Copy-Item....

folks I have a simple script Copy-Item -recurse $i.FullName $destinationIt works great except on one server.Where it copies the entire content irrespective of whether it exists at the destination or...

View Article


Script works but reports errors - do I need to be concerned?

Hi everyone.I have a script that checks SQL servers for their backup dates. It works and outputs results as expected , but produces errrors. I have had a look and can't find the issue.Invoke-Sqlcmd :...

View Article

sql query

 

View Article

SQL authentication method

Hello everyone.I hope someone can provide me some advice. I have a script which works fine, it goes thru a list of SQL servers stored in a text file and returns all those with sysadmin...

View Article

Finding Applications that use specific versions of Java

Good day all,    I wanted to know if there was a way to gather information from all devices in a domain to find out which applications are using a specific version of Java? For example, if I see 15...

View Article


copy latest diff or full to another directory

I am a newbie to Powershell.I am using Powershell as a step within my SQL job to copy the latest diff or full backup to another folder. The first step (backup database) is done thru the maintenance...

View Article

can you convert objects? System.Object to SMO

Hi all, trying to play around with a restore script to pull out random full backup file and then restore it. im having issues with the -relocatefile in "restore-sqldatabase", ive got the answers i need...

View Article


Batch File Question - Exit on Error

I have a batch file: StartFile. batcd /d %~dp0powershell.exe -File sp_script.ps1pauseI have sp_script.ps1$ErrorActionPreference;sqlcmd -b -S  myserver -d mydatabase -i sql_test_fail.sql | Tee-Object...

View Article

DBA with PowerShell = What task?

Goal: Understand better how a DBA use PowerShell in his/here daily work. Problem: I really don't understand what specific assignment does a DBA use PowerShell in order to complete task or assignment...

View Article


What PowerShell can be used For Business Intelligence

Goal: Understand better how and why PowerShell can be used in business intelligence. Problem: I really don't understand what specific assignment what PowerShell can be used in order to complete task or...

View Article

Dynamic Distribution List in Exchange 2010

Hi I am looking for a powershell script that will allow me to create a Dynamic Distribution for all the users-city = Brooklyn-state = NY-And not contractor.Under the general Tab for a user account, in...

View Article

Array not populating correctly from foreach loop

Have a report, where I fetch data, but need to insert a field, whose value is derived from what is in another field. Trouble is coming from the foreach loop. Every loop is appending an index into...

View Article
Browsing all 10624 articles
Browse latest View live