Concat hard value to each row of Hash Table
I'm a newbie to Powershell and this one is driving me nuts. I have a document with many many rows of data and many columns for each row. I am sending this data via HTTPS post to a webserver and need to...
View ArticleEncoding data with Powershell
I'm pulling a text file into Powershell so I can send it via HTTPS. But as part of the send, the data needs to be encoded as Multipart/Form-Data (MIME) format. I'm unsure if that's automatically a part...
View ArticleSQL Server Detach database
HiI am a SQL Server DBA and have never used Powershell before. I'm trying to detach a database using Powershell, but not getting very far.Have read up a bit and most ppl do it like below. I tried to...
View ArticleAdd Network Places using PoSh
I'm getting a new Windows 7 desktop. From a powershell perspective, probably a good thing.But, I have a goodly number of Network Places mapped on my XP box, and I'd like to re-create those mappings on...
View ArticleProgrammatically create a New Network Location link Windows 7
Still trying to programmatically create a New Network Location link.I've got it down to -- [i]I think[/i]:$Newlink = New-Object System.IO.DirectoryInfo "$MyPath"But I can't figure out how to set the...
View ArticlePowershell Test-Path hanging
I am running a script that checks for mdf and ldf files on all of our SQL Servers and the script gets about halfway through before it hangs. It hangs at the line:[code="other"]Test-Path...
View ArticleMSCluster gwmi access denied...locally on node..
Has anyone experienced this? I'm getting an access denied when trying to access Cluster WMI Objects...but only on a local node. I can access the objects just fine from other locations.
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 ArticleCopy files using Powershell
Hey guys, I'm trying to figure out how to copy backup files from one shared location to another. I'm looking to be able to delete files at the destination, that no longer exist at the source, so what...
View ArticleSQLPS takes 30 minutes to import. How to fix it?
Hey SSC,SQLPS on my workstation used to take around 30 seconds to import. Not exactly speed-of-thought, but acceptable.Now it takes around 30 minutes! This is unacceptable because it blocks my...
View ArticleManaging Connection properties of Maintenance plans using Powershell
Hi All,We are managing the password reset activity from a central server for a login which is used on our servers for executing jobs and maintenance plan jobs.We are using the below powershell script...
View ArticleAgent job with powershell
HiI am trying to create an agent job that looks for a file to exist and file if the file is not fount. I am using a try\catch block but the job will not fail. Any ideas?try { Get-Item -Path...
View ArticleSet_Login Error in powershell script
Hi All,I was trying to automate my Password reset activity for Sql Logins from a central servr using Powershell.With the help of some useful tips from the below link, I was able to create a script :...
View ArticlePassing Parameter to SQl Agent Job that runs powershell
HiI have created a SQL Agent Job with a powershell step. The powershell script looks like the following:[code="other"]Param( [string]$A, [string]$B, [int]$C)#Do something with $A,$B and $C[/code]Now I...
View ArticlePowershell exit code
I have a script that I'm trying to run in TeamCity, essentially I want to force an exit code if an error happens.Here's the script:[code="other"]$s = "kbullen-865";$db_name = "tempdb";$ExceptionMessage...
View ArticleCannot open file because the current provider (SqlServer) cannot open a file.
Server has SQL 2012Opened powershellsqlps got PS SQLSERVER:\> promptPS SQLSERVER:\> echo "xxxx" > tempps.txt[b]This works fine in normal powershell[/b]. In sqlps I get error:Cannot open file...
View ArticleUsing a Helper Library from a powershell script that will be running via a...
Hi I am having a Powershell Script, [b]A.ps1[/b] that calls some functions from a Helper script [b]HelperFunctions.ps1[/b]. In order to execute A.ps1 from console I make sure I have the helper script...
View ArticleUnable to run the PS query.
How to check if I have a list of SQL Servers in a .TXT file and in the list, what are the SQL Servers are not accessible/stopped/not working?$MachineList = get-content...
View ArticleHow to find number of columns returned from query in powershell
I want to find out number of columns returned from a query in a powershell script.As we will be passing a dynamic query which can retrieve only 2 columns or 5 columns or n columns based on user's...
View Articleemail if no new files in last 2 days
I have this code that works great if there is a new file in the last 23 hours. how can I adjust it that if there is no new files in the last 2 days it will send me an emailParam ( [string]$Path =...
View Article