14,972,848 members
Everything / Programming Languages / PowerShell

# PowerShell

PowerShell

by
This article describes the C# implementation for a high-performance user/role security principal hierarchy.
by
This article will teach you how to create an amazing, clean and smooth WPF/Winform UI for your native application without using any complex, unsafe, ActiveXish methods, etc.
by
How to use Microsoft Unity Interception as a solution for cross cutting concerns in a .NET application
by
Since I wrote an article previously, I had been asked on various occasions to share the code on Yahoo! or Bing, etc. I wanted to write an article, with the code, which covers all of those vendors as well.

## Latest Articles

by
How to set classification label to an Excel/Word/PDF file at the time of its creation during runtime programmatically
by
A Powershell script to rename HD video camera files using their original creation date
by
How to create, modify and update Docker image from container
by
A simple solution using Powershell for preparing emails from Windows batch in Outlook; supports HTML body

## All Articles

### PowerShell

5 Dec 2015
This article describes the C# implementation for a high-performance user/role security principal hierarchy.
6 Jan 2020
This article will teach you how to create an amazing, clean and smooth WPF/Winform UI for your native application without using any complex, unsafe, ActiveXish methods, etc.
27 Nov 2015
How to use Microsoft Unity Interception as a solution for cross cutting concerns in a .NET application
8 Aug 2017
Since I wrote an article previously, I had been asked on various occasions to share the code on Yahoo! or Bing, etc. I wanted to write an article, with the code, which covers all of those vendors as well.
17 Nov 2017
A powershell script that monitors webs sites and trace logs into database.
15 Apr 2020
This article will demo the usage of Blazor WebAssembly and how to create simple web application with it.
12 Apr 2015
A look into how we can achieve multi threading in our Powershell scripts
1 Sep 2018
In this brief article, we will demonstrate how to deploy a Node.js application and run it on Docker's Windows Server Core 2016 Containers
30 Apr 2012
Learn how to configure SMS alerts to fire based on your Windows Azure application deployment status.
14 Jan 2020
This article explains exactly how to setup an SSL certificate for FREE on your Azure account. The existing free SSL with Azure only works on 'non-naked' domains, making it pretty much worthless. This is a 100% free method which ensures your site will be 100% secure.
1 Nov 2020
Working with Windows BCD store in Powershell
15 Sep 2018
Ensure your Docker Compose services start in the correct order.
21 Feb 2012
This is a well-known thing, which is implemented in the class System.Management.Automation.PowerShell, please see: http://msdn.microsoft.com/en-us/library/system.management.automation.powershell%28v=vs.85%29.aspx[^].You can find a simple code sample...
17 May 2016
I wrote this small PowerShell script to quickly access some AbstractSpoon ToDoList documents which are stored in VeraCrypt containers. The selected container stays mounted until the ToDoList executable is closed. I use OneDrive to automatically upload the then dismounted container to the cloud.
11 Jul 2016
Despite the references of several sources of unattended installation of Microsoft SQL Server Database Engine, in this article describes a script tested in real production environments and it can be used with minimal or - perhaps - no modifications.
16 Aug 2010
A Script for determing the levenshtein distance between two strings in PowerShell
20 Sep 2010
Restore an SQL database on a local or remote SQL server using PowerShell
17 Aug 2011
Create MySQL Database backup using mysqldump
10 Jul 2014
How to use Powershell to query webservices.
21 Jul 2014
28 Oct 2014
PowerShell: Create MSMQ
29 Oct 2014
How to use Visual Studio developer command prompt with Powershell
24 Nov 2014
How to use PowerShell to carry out REST operations such as GET/POST
14 Dec 2015
PowerShell for Office 365
22 Dec 2015
Use SharePoint Commandlets in Windows PowerShell ISE
9 Jan 2017
Copy removable media more quickly by eliminating all the usual repetitive application interaction steps you normally have to go through.
18 Oct 2020
ECLP in C#
22 Dec 2020
A simple solution using Powershell for preparing emails from Windows batch in Outlook; supports HTML body
20 Sep 2010
I encountered a problem while trying to use WPF UI Automation with PowerShell - PowerShell reported incorrect type for automation elements
10 Feb 2011
Typically this is done through named arguments. Example:filename:abc.txt color:redNow the order of the parameters don't matter.
3 Oct 2011
This is one of the really good articles on the subject:Extend Windows PowerShell With Custom Commands[^]Best regardsEspen Harlinn
24 Oct 2011
19 Dec 2012
By the way, found that Microsoft official documentation on PowerShell is prohibitively bad, even though v.3.0 is finally made well usable; and Intellisense is quite good. The best book I saw so far is this one: http://www.pavleck.net/powershell-cookbook/[^].The problem with tar is: you would...
19 Dec 2012
Apart from what Sergey mentions - you have a few other options:Windows Services for Unix[^] - provides a very complete Unix subsystem on WindowsMinGW[^] - the minimalist GNU for WindowsCygwin[^]All of them are free and allows you to continue using your bash scripts on...
4 Apr 2013
Unity interception
30 Oct 2013
2 Mar 2014
Registering your powershell modules on demand with PSReg
26 Nov 2014
Describes how to resolve the 'Double-Hop' issue in PowerShell remoting and how to troubleshoot issues we may meet.
31 Mar 2015
if this is a winforms application (the "MessageBox.Show" says that it is) then hitting space will trigger an event depending on which control has focus. private void form1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == ' ') ps.AddScript("netsh...
20 May 2015
A fully functional sample Cloudformation template that generates a load balanced IIS/SQL Server based web site, plus PowerShell scripts to automatically deploy the web site on your EC2 instances
4 Jun 2015
Powershell: Get process stats
30 Nov 2015
Encoding a .NET assembly as a hex string to install in SQL Server.
29 Jul 2015
This powershell script is you to monitor windows servers’ free hard disk and populate it to sharepoint custom list.
6 Dec 2015
This tip explains about a way using PowerShell to monitor all the disabled send ports/receive locations and suspended messages and send an email about these info
19 Dec 2015
This tip will give an overview to Sitecore developer about how to migrate data using Sitecore PowerShell scripts.
9 Feb 2016
Use PowerShell Post-build scripts to check in binaries to TFS for continuous integration during the build process.
1 Mar 2016
You need to find out what's failing and then convert that code into something that works on an older PowerShell.There is no "automatic" or "setting" you can use or change to magically get it to work. Your code is using some feature that was introduced with PowerShell 2.0 that isn't available...
17 May 2016
Ugh, WIFI not working or unstable? Try this tip....
4 Oct 2016
Powershell script for Amazon Dash button Detection via DHCP Discover message
28 Nov 2016
PowerShell script to split single-file routines export from MySQL Server
6 May 2017
8 Dec 2016
PowerShell Script to Automate Hyper V Snapshots
8 Dec 2016
Here is a script to create an event source using PowerShell
17 May 2017
You are searching for product names containing "antivirus". So you will not find software that does not contain that string. You might even find software that is not an AV software. If you still want to use the Name property you have to search for strings that are used by the common AV...
30 Apr 2018
Using Powershell and Windows Task Scheduler API to detect malicious login attempts on a remotely accessible SQL Server database
28 Jun 2018
31 Dec 2018
This article provides an example on how you can change application configuration settings within an existing ClickOnce publish, update the manifest files, followed by using the Mage utility for updating the manifest using the existing cert file.
21 May 2019
How to export VS code extensions to another computer using PowerShell
20 Nov 2019
How to customize the new Windows Terminal for Windows 10 for custom font, look and feel, as well as setup terminals for git-bash, Node.js, PowerShell, and Azure Cloud Shell.
12 Mar 2020
What kinds of things should I avoid, or remove from my applications to improve my position moving forward
29 Jun 2020
Walk-through and source code for a excel VBA development workflow
20 Jun 2021
How to set classification label to an Excel/Word/PDF file at the time of its creation during runtime programmatically
24 Jul 2010
Hi Guys:I'm trying to count the Stellar process from a remote server, my code snippets is given below:function GetProcessCount($serverName){$serviceArray = Get-WmiObject -class Win32_Service -computerName $serverName ;$Counter = 0 $serviceArray | foreach { ... 11 Apr 2011 simples[^], tsk! 10 Jun 2011 Here are some PowerShell script examples for NuGet packages 10 Sep 2011 It would appear that all your SubChildNodes are being added to the first PNG node, rather than each one in turn. I have not been able to test this, but perhaps something like:$ParentNode =$file.Meta["Image"]for($j=0; $j -lt 10;$j++){ $ChildNode =... 12 Sep 2011 http://powershell.com/cs/blogs/tips/archive/2010/04/27/finding-10-largest-files.aspx[^]http://stackoverflow.com/questions/798040/find-the-10-largest-files-within-a-directory-structure[^]http://www.christiano.ch/wordpress/2009/08/11/powershell-how-to-find-large-files/[^] 12 Sep 2011 http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/0df70854-7bd6-4434-be0e-f75fd71daa43/[^]http://technet.microsoft.com/en-us/library/dd315304.aspx[^] 3 Oct 2011 Strange idea. I don't think your whole idea is really useful, but&hellip;You can create an "assembly host" .NET application which loads your assembly with functions Add, Multiply or any other, using Reflection, finds the method to be called by its full name (for example... 26 Nov 2011 you need to install powershell 1.0 first before installing powershell 2.0. These two are different.Regards,Eduard 5 Dec 2011 Hello,Assi... 15 Feb 2012 You can do it, of course, but your whole script would become "interactive" (waiting for user input) which would make it pretty much useless as such. In this case, normal windowed application could be better, as the console application with interactive input would defeat the purpose of the... 13 Apr 2012 Power shell build script for multiple projects and solutions using MSBuild, with an option to fix the build error during the build and continue, without restarting the complete build. 22 Feb 2013 importing powershell modules and executes CmdLets in windows application using Automation library APIs 10 May 2012 Hello All,I would like to know how I can execute enter-pssession command using c# code.I have used following command to run it in powershell console.$secpasswd = ConvertTo-SecureString "123$" -AsPlainText -Force$mycreds = New-object -typename...
12 May 2012
May be this might be of any help to you:After the installation of WinRM ctpv3 and powershell ctpv3 you need to reference the correct System.Management.Automation.dll.First add a reference tag from within the csproj file that you wish to use the Automation library. To do this open the...
15 May 2012
This problem occurs because the handler mapping for the requested resource points to a .dll file that cannot process the request. To resolve this problem:Edit the handler mapping for the requested resource to point to the .dll file that can process the request. To do this, follow these...
15 May 2012
Itz because ConvertToSecureString is not .NET class library, but itz PowerShell script. Just to give the background, Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers...
5 Jul 2012
Hi,I have a PS script, which will run all the cmdlets in the admin mode. I want to launch the IE in normal mode without admin previliges from the elevated mode powershell. can someone help me how to do this?thanks in advance
10 Aug 2012
Use PowerShell 2.0 to aid in the delivery of build artifacts for release, by generating a manifest of file changes.
22 Aug 2012
Why don't you use the PowerShell class[^]? It does several things for you.By the way, you dont pass parameters as parameters. Threat runspace pipeline as a process execution. You won't add parameters to the executable name, won't you? Use the CommandParameter[^] class. See here:...
25 Aug 2012
From Batch File Rename with Windows PowerShell[^]: Dir *.txt | rename-item -newname { $_.name -replace ".txt",".c" } 3 Sep 2012 The title says it all. 16 Dec 2012 By the way, found that Microsoft official documentation on PowerShell is prohibitively bad, even though v.3.0 is finally made well usable; and Intellisense is quite good. The best book I saw so far this one: http://www.pavleck.net/powershell-cookbook/[^].The problem with tar is: you would... 28 Dec 2012 As I say, writing a System.Windows.Forms application in PowerShell is quite possible.I've written this sample code write now while answering to this question. It tool me a couple of minutes. This is fully fledged minimalistic application, even with an event handler and few effects. Run it... 28 Dec 2012 Doing so is a bad idea. Processes are well isolated. How are you going to communicate with the script? It's much better to invoke PowerShell from your .NET application.Please see this CodeProject article:How to run PowerShell scripts from C#[^].&mdash;SA 30 Dec 2012 The answer depends on the type and parameter passing options for the parameters of ResourceDelegates of the function Set-CalendarProcessing, in particular, if the parameter passed from the pipeline and processed correctly. If I can assume that this parameter can accept a list of values, the call... 27 Jan 2013 Hello.I have a working powershell script to get the Windows product key from an machine in our network. The script runs well in powershell comand line but returns error when I try to run it from C#. I need this working to chart licenses in our corporation.Powershell code:function... 26 Apr 2013 What you are trying to run won't run in an out-of-the box powershell session. The missing cmdlet is one for the Microsoft System Center 2012 Configuration Manager SP1 console. So if you run a lecay powershell, you will have to import ConfiguratioManager module (see:... 25 Jun 2013 Refer: Folder Path of Powershell file In Powershell[^]Also refer similar 3,340,000 threads on simple search here[^] 24 Sep 2013 I have written a program in VB.NET VS2010 that will submit mailbox extract requests to an Exchange 2010 environment. It presents a status list view that shows submitted, queued, in progress, complete, and erred mailboxes. All of the Powershell commands are submitted synchronously.When you... 14 Nov 2013 In your sample, nothing creates event arguments. Usually it is done in the class declaring some event, when you invoke the event (.NET allows to invoke events only in the classes declaring corresponding event instance nowhere else), but you can only create "real" .NET classes in PowerShell if... 16 Nov 2013 Could you post a sample XML file?I don't think you can address the node like this: ".AdminLauncher.Categories", you have to select it to be able to add a child node.Something like this:$newCat =...
7 May 2014
A PowerShell 3.0 Form Generator.
11 Jul 2014
How to read XML files and add them into SharePoint 2010 through Powershell
28 Jul 2014
The article is about launching elevated processes through command line
8 Sep 2014
Check this!Reading Device Manager's Property Fields in Windows 7/8[^]
10 Sep 2014
In Power Shell :$computer = "LocalHost"$namespace = "root\CIMV2" Get-WmiObject -class Win32_PnPEntity -computername $computer -namespace$namespace | Where{$_.ConfigManagerErrorCode -gt 0} | FT Name, ConfigManagerErrorCode,Status 22 Oct 2014 Powershell selecting from SQL Server 14 Nov 2014 Write a functional test script for a REST API using PowerShell. 2 Dec 2014 It doesn't quite work like that.We do not do your work for you.If you want someone to write your code, you have to pay - I suggest you go to Freelancer.com and ask there.But be aware: you get what you pay for. Pay peanuts, get monkeys. 10 Apr 2015 Follow this:Using the Copy-Item Cmdlet [^]Copy-item Files in Folders and subfolders in the same directory structure of source server using Powershell[^] 10 Apr 2015 Creating multiple copies of the same file sounds like a bad technology abuse.In worst case, when some ill-organized structure really needs such multiple copies (one typical application are C/C++ header files used in different places of code), it could be much more appropriate to create POSIX... 15 Jul 2015 It is true there is nothing built into the primitive batch language that even comes close to exception handling. Never-the-less, there is a surprisingly sophisticated and robust implementation of batch exception handling posted at http://www.dostips.com/forum/viewtopic.php?f=3&t=6497, and it... 18 Aug 2015 PowerShell scripts to apply configuration transformations for App.Config or Web.Config files 25 Oct 2015$A = get-content -path $filePath | select -first 3 -last 1The problem is that you read the entire file and then transmit it to select via a pipe(|).Should certainly be better to do somothing like$A = get-content -path $filePath -head 3;get-content -path$filePath -tail 1This way,...
10 Jan 2016
Critical Error – Start Menu and Cortana aren’t working
10 Feb 2016
1 May 2016
See Powershell function return string - Google Search[^].
4 May 2016
Select-String didn't show up in PowerShell until version 3.0. You're probably running an earlier version of PowerShell.Update the version of PowerShell on the machine and you should be good to go.
26 May 2016
See Hey, Scripting Guy! Weekend Scripter: Enumerations and Values | Hey, Scripting Guy! Blog[^], that should help you debug your issue.
9 Jun 2016
I have an XML document that describes requirements. If I had Powershell code between the Values tag, could I somehow extract it and then run it? TRUE Three letter country code where the individual receives company...
9 Jun 2016
You have to achieve two different things: 1) parse XML in PowerShell, 2) when you extract some parameters and extract/compose a PowerShell command, execute this command.To start with, read this short but instructional article: Using PowerShell to read xml-files | Little more than out of the...
30 Jun 2016
29 Sep 2016
Check this:Script Get files older than a specified time period PowerShell[^]Delete files older than x-days - Cleanup Script[^]Delete files older than 15 days using PowerShell - Stack Overflow[^]And change to your needs ;)
4 Dec 2016
Step by step guide to add pre and post PowerShell scripts to TFS2012 build
8 Feb 2017
$list.Items should be$MyList.Items as you do not have a declaration for $list.Also, I would check$web.Lists["CareTeam Application"], This may also cause issuesAs a safer option, I would use the ListID/GUID of the list.To obtain the list ID, just goto the settings page of the list...
31 May 2017
Your data are not in csv format. These data are in JSON format. I'd sugges to read this: VBA - GitHub - VBA-tools/VBA-JSON: JSON conversion and parsing for VBA[^] and Parsing JSON in Excel VBA - Stack Overflow[^] VBScript - JSON Encoder for VBScript · GitHub[^] and Decode/Encode JSON with...
31 Jul 2017
Azure automation using Powershell
22 Jan 2018
The system where you enter Invoke-Command -ComputerName is a client and the remote systems passed as arguments are servers here. So you have to execute Enable-PSRemoting on the remote systems and not on yours: Enable-PSRemoting[^]: You have to run this command only one time on each computer...
2 Apr 2018
For years I have worked with Inno Setup, this might just fit your needs.
23 Jul 2018
Annoyingly, the DirectoryName property doesn't seem to work when you're sorting the results. Neither does the Parent property. You'll probably need to use Select-Object to add a computed property to the list: $deleteFolderList = Get-ChildItem -Path$rootFolder -Recurse -Directory -Include (...
21 Sep 2018
Try PasswordLastSet instead of PwdLastSet. As far as I can see, there isn't a PwdAge property; you'll need to calculate it from the PasswordLastSet property. Something like this should work: Search-ADAccount -AccountInactive -TimeSpan 90 -UsersOnly -SearchBase "OU=User...
19 Nov 2018
Automatic subscription of Azure functions to Event Grid
21 Mar 2019
Please, follow this: Use PowerShell to Work with Any INI File | Scripting[^] These might be helpful too: MartijnBrant.net » Blog Archive » Reading / parsing / writing .ini files in Powershell using XML[^] Handling ini files in PowerShell[^]
8 Feb 2020
When you create an Azure Storage account to store files in a container you can set the permissions to what ever access level you want, and you can generate tokens to access the blob storage account with set periods of time. That’s what we’re going to do here today.. 0.
9 Feb 2020
A year ago in this post we created an Azure Virtual Machine using PowerShell instead of using the Azure Portal. This is fairly simple and allows a level of automation.
11 Feb 2020
The IIS rewrite module is a really powerful feature in IIS. It gives you power to set up rules to handle how requests for specific URLs are handled.
19 Feb 2020
What's wrong on changing environment variables using Environment provider like $env:variableName = ? (see about_Environment_Variables - PowerShell | Microsoft Docs[^]: When you change environment variables in PowerShell, the... 28 Feb 2020 Using Terraform to create an Azure Virtual Machine 24 Nov 2020 An extra Get-ChildItem / ForEach-Object should work, with an added Test-Path to exclude folders which don't exist:$source = 'C:\Program Files\Mozilla Firefox\plugins\plugin.xpi' Get-ChildItem "C:\Users" -Directory | Where-Object { Test-Path...
26 Nov 2020
ScoopBox is a C# library that automates the configuration file building and generates a script which inside contains commands to execute using PowerShell.
4 Feb 2021
Install Azure PowerShell on Windows with PowerShellGet | Microsoft Docs[^]: The module described in this document, AzureRM, uses .NET Framework. This makes it incompatible with PowerShell 6.0, which uses .NET Core. If you are using PowerShell...
13 Aug 2018
23 Jun 2021
Hi,There is some code online that is supposed to do what I'm trying to do, but it didn't work for me, trying it in the PowerShell commandline line by line.I am trying to delete a certificate from the CurrentUser\My store, by its' thumbprint:Quote:get-childitem...
24 Jul 2010
As far as I know, you will need to have Administration rights in the remote machine.Try to do the following.1.Create your user in the remote machine with admin rights2.Try againHope it helps.
18 Dec 2012
So far I was using cygwin for my well known Unix scribbles to achieve some quick results on file system and file content manipulations.Since a while, I consider migrating to a pure Windows environment for such tasks. Currently, I'm struggling with the following Bash command line (is there a...
18 Nov 2010
I want to run the following in a c# loop but I just don't know how to pass a multi value for a parameter with a comma. The actual cmdlet would be below and does work in exchange powershell:Set-CalendarProcessing –ResourceDelegates jonDoe@test.com,johnnydoe@test.com -identity...
7 Dec 2010
I am new to powershell and was curious to try out new things.I wanted to get IIS 7.5 details from powershell like the ones that are mentioned below, and I wanted their values. For example : while I worked with the MSSQL , I used to get various properties details associated with each...
7 Dec 2010
Take a look at some of these[^] links.
11 Feb 2011
I am creating a cmdlet with three parameters. The first and third items are mandatory whereas the second item is not mandatory. I cannot chage the position of these parameters. How can I make it happen? I need help with this situation.I am new to cmdlets.Thank in advance. Regards...
17 May 2011
Files with different date time get different ETag generated by IIS. As a result, on a web server farm, each webserver sends different ETag for the same file as the files are copied to those servers at different date time. Here's a script that can set date time of same file across multiple servers to
20 Jun 2011
This is my Script file. It displays all the arguments that are passed to it and their count.ScriptwithArguments.ps1========================Arguments: $($args.count)$argsI'm trying to run this script from C# Process.Start()If I say... 22 Jun 2011 I haven't tried Alan's suggestion. But I found a way to make this work. Process.Start(@"path\to\Powershell.exe", @""" 'ScriptwithArguments.ps1' 'arg with space' 'more args' """); 27 Jun 2011 Hi, I have listed below sample code through which am trying to acheive Multilevel calling of Powescript files Batch file.SingleLevel.ps1function SingleLevel{ Write "This function is called directly from the batch file" MultiLevel}MultiLevel.ps1fucntion MultiLevel{ ... 27 Aug 2011 TaskList shows incorrect data - Use PowerShell instead 11 Jul 2011 An article describing some of the tricks of PowerShell scripts and profile that enables you to get a bash like prompt in PowerShell and run applications more flexibly. 22 Jul 2011 Windows Remoting works perfectly for same domain situations, but has some gotchas in mixed domain scenarios. 28 Jul 2011 Extract variables from a persisted workflow to debug an issue or to verify your persistence 8 Aug 2011 How to generate entity classes dynamically in your build processes using PowerShell scripts 4 Aug 2011 Hello Friends, I'm trying to run a bunch of powershell script files one by one through a c# winform application using Process.Start(). Whenever I start a powershell for a scriptfile, it creates a new Powershell Process and runs a script file.The problem with this is that, i'm... 5 Aug 2011 I'm using Process.Start() to start Powershell to execute a script. I would like to run multiple script files one after the other in the same Powershell Window so that they all have the same session.Please let me know if there is a way to achieve this .Thanks in Advance ! 5 Aug 2011 Good suggestion from digimanus - you could even be a bit smarter and create the controller script on the fly. 6 Aug 2011 See here[^]; I don't know what your problem is, but a Google search should always be your first step in cases like this. 23 Aug 2011 I have a folder conatins few images(.png files), one xsl file which is linked in xml file and few URLs which are present in xsl, and a xml file. Could anyone please let me know how to create mhtm file using the xml file using powershell or .net or vb script? output: *The mhtm page should be... 23 Aug 2011 This will probably help: Convert HTML to MHTML using ASP.NET[^] 10 Sep 2011 here is the hierarchy that need to create in XMLExample:MyFile- my current implementation:[xml]$file = Get-content C:\MyFile.xml$Parent... 10 Sep 2011 Appreciated...... 10 Sep 2011 When i execute the below statments, i can see the directory path [array]$PNGsDirectory = Get-ChildItem C:\FileName\ *.png -recurse | Select-Object Directoryfor($j=0;$j -lt $PNGfiles.Count;$j++) {Write-Host...
18 Sep 2011
Hi,I have a mhtml file as test.mhtdata present in test.mht is as belowField String Name Carpool Type ModernApplication Language en-us English Category Tools IsTrial false GUID 712ec8b1-0370-4ed5-b1ac-f0eca1f64348 MarketsMarketName United States ...
18 Sep 2011
Not entirely sure what you are trying to achieve, but try something like this:[array]$PNGsDirectory = Get-ChildItem C:\FileName\ *.png -recurse | Select-Object Directoryforeach($Directory in $PNGsdirectory) {Write-Host$Directory.Directory.FullName}$PNGsDirectory contains... 19 Sep 2011 Delete all alerts for a specific list or library on SharePoint. 19 Sep 2011 I found this piece of code[^] that might do the job. 20 Sep 2011 Explains an alternative way of stsadm restoration of a Site Collection. 3 Oct 2011 I am use below code. using that i can execute C# code. but I want to execute only C# function. pls any one can help ..........$source = @"public class BasicTestererr{ public static int Add(int a, int b) { return (a - b); } public int Multiply(int a, int...
6 Oct 2011
Build a simple GUI in PowerShell that will display data queried from a SQL Server table.
26 Oct 2011
hi, i'm working on a C# project which interacts with Powershell. I managed to invoke powershell scripts, but how can I get back the values of the powershell variables? Thanks! It's Urgent!
26 Oct 2011
I have no idea if this is possible, but since it is urgent I would suggest checking some of these links[^].
8 Nov 2011
Hey there,i´m developing an application for mobile devices in ASP.NET with access to an Exchange Server 2007. I know you can get with "Get-ActiveSyncDeviceStatistics -Mailbox name" in Powershell information about the userdevice, like FirstSyncTime, DeviceId or DeviceModel. I want to know...
26 Nov 2011
in the process of setting up a new/old laptop just as a secondary programming laptop.. im using win xp sp3 32 bit..im almost certain powershell 2.0 installed along with vis studio but cant be sure, how can i be sure..?furthermore, the reason im needing to know is because sql server...
26 Nov 2011
If in doubt, just reinstall and the installation will tell you if it has been installed or not.
30 Nov 2011
I have created Form in Powershell 1.0. It contain 50 controls like Label, Radio Button, Edit Box. I have to apply the specific font to all these controls. Now i am applying font to individual control. I want to apply font to all control in one time.
7 Dec 2011
Use PowerShell to Query and Display Data II (Active Directory\LDAP)
27 Dec 2011
How can i get all registry keys value like HKLM\Software\Policies\Microsoft\WindowsMediaPlayer may be there are more than hundred keys how can retrieve all keys and there values so that i can apply settings on themfrom c# or PowershellPlease help
27 Dec 2011
Use the Registry[^] class.
28 Dec 2011
Check this outRead, write and delete from registry with C#[^]
28 Dec 2011
Here another good example link Here[^]
28 Dec 2011
Hi, I've been learning Powershell and creating some admin scripts. I'd like to be able to be able to give colleagues the access to run these scripts via a web page (and also have the results of the scripts returned via a webpage) but am unsure on how to go about this - do I need to look at...
7 Jan 2012
Customizable Custom CSharp Control for the Powershell New-PSDrive cmdlet
23 Jan 2012
See if this sample of FileSystemAccessRule helps you look into the right way: http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesystemaccessrule.aspx[^]
15 Feb 2012
I'm kind of new in powershell, so please pardon me..Let's say we want to create a simple .exe file which can be executed in powershell..Let's say the program is basically can do:if "a" is pressed, it will print the string "a is being pressed" on a new line.if "b" is pressed, it will...
12 Mar 2012
Power shell script for upgrading Visual Studio 2008 solutions and projects into Visual Studio 2010.
21 Feb 2012
HelloI have a question i can't seem to find an answer to, and i hope someone can help :)I want to create a application similar to Yakuake, Tilda, etc.Currently i have been able to achive something simelar to this by using a textbox to enter the commands and another textbox to display...
5 Mar 2012
Hi,i am calling powershell script using asp.net,C#,on powershell prompt.when i run application using visual studio its works fine on same system,but when i host same website in iis on same system it gives error.means script unable to access to data error after hosting site in iis...
5 Mar 2012
sure you load the correct bit-wise version of PowerShell. If you're running the 64 bit version then you'll get the exceptionCould you verify using the x86 powershell console as[System.Reflection.Assembly]::LoadFrom( "C:\windows\system32\inetsrv\Microsoft.Web.Administration.dll" )rather...
5 Mar 2012
i have resolved this problem doing some changes in iisin iis application pool coose advance setting --> in process model --> change identity from applicationippool to local system.Thanks all
17 Apr 2012
try following:Process.Start(@"path\to\Powershell.exe", "&'@"-File ""ScriptwithArguments.ps1"" ""arg with space""'""")
17 Apr 2012
Heya Guys, I am trying to connect to a wsman service in VB.Net to admin some exchange accounts. The code I have to perform the connection and make the changes are as follows Const SHELL_URI As String = "http://schemas.microsoft.com/powershell/Microsoft.PowerShell" ...
18 Apr 2012
3 May 2012
Hello,I was trying to connect to a machine(192.168.1.194); using powershell using the following query Enter-PSSession 192.168.1.194. But I got the following error. Enter-PSSession : Connecting to remote server failed with the following error message : Access is denied. For more...
3 May 2012
First, this has absolutely nothing to do with C#, so I fail to see why you tagged your question "C#". It should have been "PowerShell".Second, what part of "Access Denied" and "see the about_Remote_Troubleshooting Help topic" you listed in your error message is difficult to understand?
15 May 2012
Recently a task is assigned to me to create a script which restores mutiple databases on SQL Server 2008 R2 server. Powershell was asked to be used..\The daily backkups are stored at share location from where robocopy is done to one of SQL Server. The data files and log files sit a predefined...
15 May 2012
How can I get the URI of my Exchange server 2010 hosted in my network. And what will be the URI of powershell in that sever?Actually I would like to know how I can use the following code?System.Uri uri = new Uri("http://CAS-SERVER/powershell?serializationLevel=Full");When I used it as...
15 May 2012
For Outlook Web Access:https://your.server.ip.address.or.dns.name/owa[^]For Exchange Web Services:https://your.server.ip.address.or.dns.name/ews[^](provided you are talking about Exchange 2010, which you did not mention).
15 May 2012
Hello,Wher...
16 May 2012
First, check if your URL is correct.Based on the error message, there might be something wrong with Exchange server configuration.Have you enabled Remote Exchange Management Shell as described...
16 May 2012
Try registering the snap-in using C:\Windows\Microsoft.NET\Framework\v2.0.50727InstallUtil c:\program files\microsoft\exchange server\bin\microsoft.exchange.powershell.Configuration.dllNote the difference is in using 32bit version of InstallUtil
25 May 2012
I am new for PowerCLI Scripting. If I connect with my local host (192.168.1.170). Its connected successfully. But If I connect with Virtual Machine (192.168.1.179). Its throws an error. Details as follows.PowerCLI C:\Program Files\VMware\Infrastructure\vSphere PowerCLI> Connect-VIServer...
30 May 2012
If you already have the Powershell code to restore one database file, you are nearly done. Simply do a Powershell command to list all of the backup files in your folder (wherever they are). Then pipe those file names into your restore script and replace the hard-coded file name in the script...
30 May 2012
Thanks.I have developed the script using for each loop which picks the backup files from a pre defined location, verify backup, read header , does processing for multiple data files and sends an email when restore fails.
10 Jun 2012
PowerShell script that generates an HTML report displaying different information about the SQL Server databases, their CLR assemblies and owners.
15 Jun 2012
Not sure if this is what you're looking for, but try this link:ConvertToSecureString Class[^] on MSDN.It has some examples there. Edited: This can't be the right answer :)On second thought look at the comments at the bottom here[^]Maybe that's where this mysterious method came from...
15 Jun 2012
18 Jun 2012
18 Jun 2012
I have a FTP server. On the FTP server, there will be log files per day and alsothere will be multiple files per day. Each file will have datetime stamp appended to filename as follows,log_date_time.csv (log_DDMMYY_HHMM.csv)Some of example filenames for same day are,...
2 Jul 2012
You write, not us!It does not work like this here.Here is what is expected of enquirers:1. TRY first what you want to do! You may find that it's not that hard.2. Formulate what was done by you that looks like an issue/not working. Try them and tell if you face issues.Members...
3 Jul 2012
How to use PowerShell script that will show the free space on the C: drive of your virtual windows machine. Get-WMIObject Win32_LogicalDisk -filter "DriveType=3" -computer localhost | Select SystemName,DeviceID,VolumeName,@{Name="Size(GB)";Expression={[decimal]("{0:N1}"...
3 Jul 2012
You will need to have network access to your virtual machine if you want to use this particular script. Once you set up your virtual machine to be on your local network like any other physical machine, you can then access it via name or IP address. You would change the "-computer localhost" to...
19 Jul 2012
Powershell script that automatically installs and updates your Chromium browser in Windows
11 Jul 2012
You can use Windows Automation Snapin for PowerShell, please see:http://wasp.codeplex.com/[^].&mdash;SA
12 Jul 2012
you've either got to develop an application that understands all the formats you want to search through - Lotus Magellan, anyone? - or use someone else's technologyMS Search seems to know quite a few formats and has an SDK[^]
18 Jul 2012
So then what's the problem? Any reason you can't use Dictionary[^] or Hashtable[^]? As far as I know, you can use .Net objects in PowerShell.
23 Jul 2012
PS > $hash = @{}PS >$hash['class1'] = @('student1')PS > $hash['class1'] += 'student2'PS >$hashName Value---- -----class1 {student1, student2}
14 Aug 2012
Hi,Can someone help me on how to check and install the Windows Updates(WU) forcibly on my local machine? I tried the below but no luck.$key = @{ Path = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\WindowsUpdate\AU' Name =... 22 Aug 2012 Hello,I am new powershell script in c#. I have a powershell script file ps.ps1 and powershell settingfile ConsoleSettings.psc1 C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -psconsolefile "D:\e\ConsoleSettings.psc1" -noexit -command ". 'D:\e\ps.ps1'"run it and get... 25 Aug 2012 Suppose I have a large number of files in a directory with the .txt extension.How can I change the extension of all these to .c?I KNOW THAT ' ren *.txt *.c ' works from command promt but it did't work from power shell and for terminal.please help! 31 Aug 2012 Here is are two tutorials about how you can access the AutoUpdate object from... 2 Sep 2012 Hi,how can I read and automated processing of XML nodes with a "-" in the name with PowerShell. I found this in the help for select-xml: ... 2 Sep 2012 I suppose, you don't need the path and the node name. So you can use one of these, supposing, that$books contains the xml:$books | select-xml -xpath "//edition" | % {$_.Node."#text"}$books.SelectNodes("//edition") | % {$_."#text"}$books.book.projects.project."book-editions".edition | %... 2 Sep 2012 Similar to Zoltan's solution, but displays all three columns with headings, as required:$xml = @"
5 Oct 2012
i have one list for examplelist 1 emp, at location 1name-----empid------salaryemp1------1---------123emp2------ 2------563now when i export this list to location 2 it will be imported as it is but now i make changes in list at location 1, i will change employee 1 name...
16 Oct 2012
hey guys..I am little bit shy of what am I asking for, but I have no experience in PowerShell language..I am working on a project using C#.. where I need to read an output of "1 cmdlet" and pass this output as a parameter to another cmdlet...I know it's easy to do using C#, but I am...
16 Oct 2012
Use the PowerShell class[^]? Use the AddCommand[^] method to add cmdlets to the processing pipeline. See also: http://stackoverflow.com/questions/527513/execute-powershell-script-from-c-sharp-with-commandline-arguments[^], where you can see an other approach that uses runspace pipeline.
18 Oct 2012
In this article we will explore a scenario of adding a custom User Profile property and generating a report based on it.
26 Oct 2012
Hi all,Passing parameter for remote execution for powershell script is not working Here the script is present on local machine and has to create a VM on HyperV server while passing servername as paramanterInvoke-Command -ComputerName OIP-HyperV -FilePath...
26 Oct 2012
You need to read up on how to use UNC path's. C:\ is a local drive that may exists on another computer (dos/windows only) but likely doesn't have the same data. You need to use a more rigorous path definition that specifies the path more specifically, which is UNC....
30 Oct 2012
I am creating a Document Set for a library using powershell and that document set contains some mandatory managed metadata fields. I am able to create document set but how can I insert data into those managed metadata fields at runtime?
30 Oct 2012
The only thing I did is removing double quotes from the argument and it stated working fine!!! thanks for all your help :-)
30 Oct 2012
Hi,Does anyone know thw cmdlet for using existing VHD while creating new VM in Hyper-V, please share with me.Thanks,krishna
1 Nov 2012
Configure an Azure solution to create users during deployment
15 Nov 2012
Hi all,I want to configure IP to the new VM using powershell.the hyper-v server can be win2k8 R2 or 2012.The VM has OS and switch.Please let me know the powershell commands for this.
30 Nov 2012
How to change the name of a SharePoint site in URL
8 Dec 2012
This may not be the right place to request something like this, but I'm hoping at the very least I can get some direction.We currently have a variety of spreadsheets and .bat files we run in preparation for major deployments. It's quite tedious. I would LOVE to be able to get a tool created...
27 Dec 2012
Hi friends, I am a fresher in Sharepoint. I have been assigned a task of making the process of deploying a wsp file automatic. For this I need to develop an .exe file which can do all the stuff. I have checked the codeplex project "Sharepoint Solution Installer". But it is not sufficient...
28 Dec 2012
In your case, it will be:$value = [BasicTestererr].Add(4, 1)&mdash;SA 28 Dec 2012 Srivikas - You could use something like this. You'll have to check the SharePoint powershell stuff:using System.Management.Automation;using System.Management.Automation.Runspaces;public class PowershellAutomator{ private Runspace _runSpace; public void... 1 Jan 2013 In addition to the correct Solution 1:For complete form of font creation, you should use regular .NET API:In any cases, first you need to load the required assembly in your script:$null = [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")and only...
2 Jan 2013
Get-ChildItem -recurse | Where {$_.PSIsContainer -and ` @(Get-ChildItem -Lit$_.Fullname -r | Where {!$_.PSIsContainer}).Length -eq 0} | Remove-Item -recurse -whatifnow i can use the above PowerShell script to delete files permanently, but now i want the files be removed to recyle... 2 Jan 2013 This should help, similar question,http://stackoverflow.com/questions/502002/how-do-i-move-a-file-to-the-recycle-bin-using-powershell[^] 2 Jan 2013 Look at these ones (source[^]). Not elegant, since they invoke COM :(, but should work:$shell = new-object -comobject "Shell.Application"$path = ""$item = $shell.Namespace(0).ParseName("$path")$item.InvokeVerb("delete")or$shell = new-object -comobject...
4 Jan 2013
I am trying to run the following script and i get an error: Exception calling "UploadFile" with "2" argument(s): "The remote server returned an error: (404) Not Found."At C:\config\ftp1.ps1:16 char:22+ $webclient.UploadFile 6 Jan 2013 How to convert multiple SharePoint 2010 projects to SharePoint 2013 10 Jan 2013 hi, i have windows server 2008r2 with sharepoint 2010 intalled I got backup of one of my site by performing " Export site or list" option in central administration. then i got a file named xxx.cmp as site backup. I am restoring onto my another website through windows powershell using... 21 Jan 2013 Update the "Created By" and "Modified By" Columns in SharePoint lists using PowerShell 27 Jan 2013 Hi All,I have a powerhsell script( to get the mailbox size of an exchange 2010 mailbox), and I am executing this script in my C# code. The following is the code I have used for that powershell.AddScript(strQuery);Collection objPS = powershell.Invoke();I tried to get the properties from... 22 Jan 2013 Hello everybody.I am trying to create a regular web part page with powershell and I am not able to do it. There is no information in google about the error I get:$spWeb = Get-SPWeb -Identity "http://server/site"$pubWeb... 14 Feb 2013 Back End : Ms Access Front End : Vb.Net or Asp.Net or PowershellMailing : Outlook or server side(gmail or yahoo)I need to retrieve the data from database and send an email to the user.Scenario for Example:Database looks like below,Product_ID Product_Name ... 14 Feb 2013 You can send mail from Outlook by using Exchange web Services. The below link will help you.http://code.msdn.microsoft.com/Send-Email-with-Exchange-50189e57[^]Examples on MSDNhttp://msdn.microsoft.com/en-us/library/ms878112[^]Hope this helps 15 Feb 2013 PowerShell in general can be used for searching text in files. The same fearture helps to get required debugging info from log files on the production server, 18 Feb 2013 Add -Recurse option to get-childitem 7 Mar 2013 Code sample to monitor file size on server. 14 Mar 2013 In this article, I will show you how to configure the "GitHub for Windows" application to interact with a BitBucket repository. 26 Mar 2013 Hi,I am trying to take a BackUp of a Site Collection from a remote computer, but I am getting a error that i am not sure of the script is:Invoke-Command -ComputerName remotecomputername -ScriptBlock {Backup-SPSite -Identity "http://remotecomputername:8080" -Path... 26 Mar 2013 I am not a big SharePoint guru, but I think you can't do this directly.1) You have to enable PSRemoting: http://technet.microsoft.com/en-us/library/hh849694.aspx[^]2) Than enter remote session: http://technet.microsoft.com/en-us/library/hh849707.aspx[^] or import remote session:... 29 Mar 2013 Hi,I am Trying to Run Powershell from C# with the help of System.Diagnostics.Process class.I tries passing commands to the powershell as Arguments but Nothing happens here. Powershell starts in the Task Manager but it does not accepts the commands.Plz tell me changes is required here to... 29 Mar 2013 Hi,I am trying to execute powershell to copy some files from one server to another in .Net.I have executed copy-item command using system.diagnostics.process from the C#. But When the Copying of files completes the Powershell Remains Open. and I have to End the Powershell Manually from... 2 Apr 2013 You have a syntax error in the commands that you are sending to PowerShell.Change your code a bit so you can see the error message from PowerShell. In Visual Studio Debug mode, capture the value of "c" just before you assign it to startinfo.arguments and use it in an interactive PowerShell... 1 Apr 2013 Wait for Retract / Uninstall before Remove. 2 Apr 2013 The first problem I can see is that your calculated$now is not really the date. Yes, this is a bit confusing&hellip;"Today" means that you need to check up if some time is greater of equal the any time of the same date. This is not what happens in your code. Let me run this code right...
4 Apr 2013
Hi All,I was trying to execute following exchange server 2007 (powershell) command.$server='exchangeserver.abc.local';$pwd= convertto-securestring '123' -asplaintext -force;$cred=new-object -typename System.Management.Automation.PSCredential -argumentlist 'Administrator',$pwd;...
7 Apr 2013