Deleting reports and un used data sources by powershell
Hi Friends,I have a task to delete reports in share point. I get the information of those reports that needs to be deleted in a file and I have to delete them all. And also I have to delete all the un...
View Articleconnect to sql server with AD user object
Is there some way I can connect to a SQL Server using an Active Directory user object? Something along the lines of this pseudocode:$User = get-aduser "domain\Some_user_that_isn't_me"$Connection =...
View ArticleGet-ADGroup with wildcards
Using the Quest AD cmdlets, this easily returns all groups with underscores around the $Code.Get-QADGroup "*`_$Code`_*" How can this be done with Get-ADGroup (ie, not using the Quest cmdlets, which not...
View ArticleSQL Agent Job - Powerhell Script With Parameters Failing
I have a PS script that has three parameters: -ConfigurationGroup "$ConfigurationGroup" -PolicyCategoryFilter "$PolicyCategoryFilter" -EvalMode "$EvalMode".Some of these values can have spaces in them...
View Articlepowershell WMI error: "Could not obtain SQL Server Service information. An...
I get the following error when I launch powershell from SSMS, after right-clicking on a remote SQL instance and choosing "Start powershell":[quote]Warning: Could not obtain SQL Server Service...
View ArticleDetermining if a server is clustered or stand-alone
I'm in the process of writing a powershell script to inventory my SQL Server environment. In collecting the server information, I'd like to grab the physical hostnames that make up any clustered...
View ArticleNeed help to get file count from remote server directory using powershell
Hi, I need help to get file count from the directory "T:/System Volume information" from a remoter serverI'm trying to run below PSEXEC command but its failing.[code="plain"]psexec \\MYSERVER28 -S cmd...
View ArticleCode not working
This used to work for me (with my own servers and dbs, and some other customizations) in PowerGUI.Now, the TransferData() method throws "Exception calling "TransferData" with "0" argument(s): "Object...
View ArticleUsing PS to configure SSRS 2012
Hello,I have had a look around the forums for an existing thread on this subject but have not come across one. I have been tasked with writing a Powershell script to automate the configuration of SSRS...
View ArticlePowershell Permissions
I am attempting to run a Powershell step through SQL Agent.The owner of the job can execute Powershell from outside SQL Agent. I have created a credential and given it proxies for Powershell, SSIS...
View ArticleSqlBulkCopy.WriteToServer not able to convert empty values to null in...
[u][b]Background:[/b][/u]I am trying to insert csv data into sql table using Powershell script(Import-CSVtoSQL.ps1) given on following web...
View Articlemove files not working using Powershell in SQL Agent Job
I have this simple move files command that works fine in powershell prompt. However, if I schedule a SQL Agent job (on SQL Server 2014), the job fails to copy the files (the job itself did completed,...
View ArticleLoop thru SQL files, second file doesnt run when results are aliased
I have a script that loops through *.sql files in a folder. It's OK if I do not alias the column result but will only run the first SQL file if I do use aliases.[code="plain"]#Loop through the .sql...
View ArticleNeed help to run a Powershell from SQL Server
Hi All,I have a requirement to kick off a[b] Powershell script[/b] and pass a [b].txt[/b] file with it.it works fine in [b]Powershell ISE[/b] but I'm not able to run in from [b]SQL...
View ArticleCant work out why this bit of PS isnt working
hello,I am following an online tutorial to help me learn powershell. It's pretty good but I have a piece of code from it, and although typed exactly correct, is not working and I cant figure out why,...
View ArticlePOwershell script
I have this powershell script as step 1 in a sql job.[System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources()It creates a text extract with 4 columns as below.ServerName InstanceName...
View ArticleCase Sensitive DB Name problem
I have a powershell script that scales up a SQL Azure database. It uses the cmdlet Get-AzureSqlDatabase.Users can pass in parameters to specify things like DatabaseName.Unfortunately, this parameter is...
View Articleservers list in a domain
When I run this script in a SQL job and have the output to a text extract.Script:[System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSourcesThis is what I see as underneath in the text...
View Articlecapture invalid connection
Hi How to capture invalid connection with powershell?$conn = "MyServer\InstanceThatDoesNotExist"try { $serverInstance = New-Object Microsoft.SqlServer.Management.Smo.Server ($conn) ;...
View ArticleScripting CDC objects with powershell
For a Long time we have been using the following script to create a Schema only copy of our database for testing [code="other"]$Filepath='C:\Temp\' # local directory to save build-scripts...
View Article