w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Delete a list of files from a list of servers in powershell
$REMOVE is an array whose elements are each line of remove-list.txt. In \$computer$DESTINATION$REMOVE, $REMOVE expands to a list of the array's elements. There's nothing in your code that tells PowerShell to iterate through the elements of $REMOVE. You need an inner loop: foreach ($computer in $computerlist) { foreach ($file in $REMOVE) { Remove-Item "\$computer$DESTINATION$file" -Recurse } } BTW, what exactly is -Recurse intended to accomplish? Were you thinking that this would make Remove-Item iterate through an array of filenames at the end of the path? That's not what it does. The -Recurse switch tells Remove-Item to remove not only the item specified by the path, but all its children as well. If you're invoking Remove-Item on a filesystem, you'd use -Recurse with directorie

Categories : List

List metadata of .wav files in commandline via powershell
Not sure to clearly understand your question, But I think that you don't need all that stuff. $folder = 'c: emp est' foreach ($file in (get-childitem $folder)) { $file.FullName $file.name $file.CreationTime $file.LastWriteTime $file.Length }

Categories : Powershell

Angularjs checkbox checked by default on load and disables Select list when checked
If you use ng-model, you don't want to also use ng-checked. Instead just initialize the model variable to true. Normally you would do this in a controller that is managing your page (add one). In your fiddle I just did the initialization in an ng-init attribute for demonstration purposes. http://jsfiddle.net/UTULc/ <div ng-app=""> Send to Office: <input type="checkbox" ng-model="checked" ng-init="checked=true"><br/> <select id="transferTo" ng-disabled="checked"> <option>Tech1</option> <option>Tech2</option> </select> </div>

Categories : Angularjs

tfs2010 same label different branches
In case it helps anyone. According to http://msdn.microsoft.com/en-us/library/ms181439(v=vs.80).aspx (the vs2010 one does not mention this but it still applies): Labels created within the graphical user interface are scoped to the root folder of the team project within which they are created. Labels created from the command line are scoped to the longest common path shared by the items specified in the label command. Not sure why MS have chosen to do this, as you can right-click a branch / folder and select "Apply Label" which is kind of misleading.

Categories : Visual Studio 2010

TFS2010 & VS2012 which SDK should be placed on the server?
You'd need to install: Team Foundation Server 2012 Object Model .NET Framework 4.5 And optionally Visual Studio 2012 update 3 to bring the object model up to the latest version. This should only install the updated version of the object model. Or recompile against the 2010 binaries and install: Team Foundation Server 2010 Object Model SP1

Categories : Web Services

PowerShell Send Popup Message to users in group
As far as I understand. You can execute the script on a remote computer, but the user will not see the popup. This is because the remote process is not allowed to interact with the user Desktop. PS : have a look to this answer I think that on XP you can use NET SEND in upper versions you have MSG.EXE or third party WinSent.

Categories : Powershell

Retrieving AD users from Powershell and exporting to csv, then Import csv to SQL via SSIS
I did not Enter " for the Text Qualifier in the Flat File Connection Manager Editor Under GeneralformatText Qualifier.

Categories : Powershell

Ldap filter to search for users in a given domain (using powershell)
I think the following filter should work: (&(objectCategory=person)(objectClass=user)(dc:dn:=mytestlab)(dc:dn:=com)) The filter above is called an extensible match search because it specifies an attribute name: dc and the DN’s attributes should be considered as part of the entry.

Categories : Powershell

Powershell Script : Unzip files and execute bat file within the zip files
Why not embed the one line from the batch file in the powershell script, then you can use the variables in your powershell script. Simply put cmd /c before the copy: cmd /c copy "$NewLocation*.prn" /b \PCPrinter

Categories : Windows

Copying files and renaming files into the original folder using Powershell
In PowerShell: Get-ChildItem 'C:somefolder' -Filter 'main.txt' -Recurse | % { Copy-Item $_.FullName (Join-Path $_.Directory 'temp.txt') } In batch: @echo off for /r "C:somefolder" %%f in (main.txt) do ( copy "%%~ff" "%%~dpftemp.txt" )

Categories : Powershell

Adding checked items in a custom list view to array list in android
initialize the "ArrayList" ArrayList<List> selectedItems; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home_page); selectedItems = new ArrayList<List>(); }

Categories : Android

View total lines of code by check in in TFS2010
Taken from here. If you are using also the TFS Build feature you can use a standard report to view the code churn: Build Quality Indicators. If you are not using TFS Build then you can use this guide to get that information: The guide is presuming that you want a filter based on the Build Definition but you do not have to use that. You can use a Changeset ID as a report filter and get all the details that you need regarding the code churn.

Categories : Tfs

How to get a list of checked item from Check List VB. Net Winform
How about using CheckedItems collection instead? EDIT: dim itemChecked as Object For Each itemChecked In checkList_Facility.CheckedItems MsgBox(itemChecked.ToString()) Next

Categories : Vb.Net

All checkboxes get checked when one is checked (should be just the one checked) - inputs generated with angular js
This (plunker) is how I would do it. The idea is to create a model to keep track of checked groups. JS app.controller("WebsitesCtrl", function($scope) { $scope.newSite = {}; $scope.newGroup = {}; $scope.checkedGroupIds = {}; $scope.sites = []; var groupMap = {}; $scope.groups = []; var siteIdSeq = 0; function createSite(newSite, groups) { $scope.sites.push(newSite); newSite.id = siteIdSeq; newSite.groups = groups; siteIdSeq++; return newSite; } var groupIdSeq = 0; function createGroup(newGroup) { $scope.groups.push(newGroup); newGroup.id = groupIdSeq; groupMap[newGroup.id] = newGroup; groupIdSeq++; return newGroup; } $scope.submitSite = function() { var groups = []; angular.forEach($scope.checkedGroupIds, func

Categories : Angularjs

Running VS2012 unit tests from TFS2010 Team Build
Installing VS2012 Ultimate on the build server caused the Invalid switch errors when running MSTest to go away and the MSTest could run successfully. I had earlier installed VS2012 Professional and VS2012 Team Explorer, but these editions "obviously" (discovered after lots of debug runs!!) do not contain the required version of MSTest. The information about MSTest command line options does not mention this (MSDN Command-Line options for publishing tests), only mentioning that Team Explorer must be installed.

Categories : Visual Studio 2010

Authenticating user trying to access TFS2010 through webform on remote server
There are several things you need to do and approach this issue First most likely you have anonymous authentication allowed for your website. Meaning users can access your site without any restrictions and wont need to provide any information. Webserver doesn't know who they are. This will need to be disabled as by your question you need their info. You web app will try to connect to tfs under the webservers identity - either the dedicated account running the application pool or computer account. http://technet.microsoft.com/en-us/library/cc770966(v=ws.10).aspx The most simplest method is to enable basic authentication for your website, this will request users to provide username and password, downside is this method transmits data in base64 plain text, as such you channel must be secur

Categories : C#

.csproj files not getting checked in to TFS
I know this is quite an old question, but I've just had a very similar situation. My solution was to turn on "show all files", and for each missed file, right click and "add to source control". I did the same at project level where the root project files were missing.

Categories : Tfs

php code not executing. Checked config files already
Check your MS SQL Connection and use $_GET['Username'] in place of $_GET(USERNAME) $query = "SELECT COUNT(*) FROM Users WHERE Username='".$_GET['Username']."'";

Categories : PHP

How to list all events from a particular folder which are going on today? And email the list to users
You can use a collection to get all events which contain today in their daterange and for the mail-sending you can use colective.contentrules.mailtotogroup. It is capable to send the body-text-field, too. If that's what you were looking for.

Categories : Email

How to query all the files checked out by a user in Visual Studio 2012 TFS
You can do it from the commandline, using tf.exe status Microsoft (R) TF - Team Foundation Version Control Tool, Version 11.0.60315.1 Copyright (c) Microsoft Corporation. All rights reserved. Displays information about pending changes to items in one or more workspaces. tf status [itemspec] [/collection:TeamProjectCollectionUrl] [/login:username,[password]] ([/workspace:workspacename[;workspaceowner]] | [/shelveset:shelvesetname[;shelvesetowner]]) [/format:(brief|detailed)] [/recursive] [/user:(*|username)] [/nodetect] Or using the Team foundation Server Power Tools for Visual Studio 2012. Team Explorer Enhancements This tool provides additional Visual Studio menu options and functions to support finding files under version

Categories : Visual Studio 2012

Syntax for a Checked List Box
For web development (ASP.NET) do this: For Each item As ListItem In checkedboxlist1.Items If item.Selected Then ' Run your XML code here End If Next For Windows development (WinForms) do this: For Each item In checkedboxlist1.CheckedItems ' Run your XML code here Next

Categories : Vb.Net

Powershell - Mix 2 XML files
Here's one way to do it, your files are contains invalid xml, fix them and give this a try. $newXml = @" <configuration> <protocol> <NATIVE></NATIVE> <ICAP></ICAP> <RPC> <ClientList> <items> $( $xd.SelectNodes("//configuration/protocol/RPC/ClientList/items").InnerXml $xd2.SelectNodes("//configuration/protocol/RPC/ClientList/items").InnerXml ) </items> </ClientList> </RPC> </protocol> </configuration> "@ $newXml | Out-File $xmlpath2 Remove-Item $xmlpath1 -Force

Categories : Xml

Sorting the checked items which are on top of list
Here is what I see from your example fiddle : your checkboxes are sorted by their checked status, and if two checkboxes have the same checked status, their relative ordering is the same as their initial ordering. Initially, Five is at the end of your list, so it will always be sorted after all other nodes (with respect to its checked status). You seem to want to see Five appear before Our or Ours : why don't you fix the order in the initial html ?

Categories : Javascript

How to grey out item in a Checked List Box
You have to create your own CheckedListBox like this: public class CustomCheckedList : CheckedListBox { public CustomCheckedList() { DisabledIndices = new List<int>(); DoubleBuffered = true; } public List<int> DisabledIndices { get; set; } protected override void OnDrawItem(DrawItemEventArgs e) { base.OnDrawItem(e); Size checkSize = CheckBoxRenderer.GetGlyphSize(e.Graphics, System.Windows.Forms.VisualStyles.CheckBoxState.MixedNormal); int d = (e.Bounds.Height - checkSize.Height) / 2; if(DisabledIndices.Contains(e.Index)) CheckBoxRenderer.DrawCheckBox(e.Graphics, new Point(d,e.Bounds.Top + d), GetItemChecked(e.Index) ? System.Windows.Forms.VisualStyles.CheckBoxState.CheckedDisabled :

Categories : C#

Create list of checked elements
You can add a isCheck variable to your People class. Then you can try List<People> list= new ArrayList(); for(People item : accounts) { if(item.isCheck){ list.add(item); } }

Categories : Java

Asp.net Page with C# : How to keep a list of checked checkboxes?
One option would be storing the list in the Session and using a property to save or retrieve it. Please try: protected List<int> CheckedIDs { get { List<int> checkedIDs = new List<int>(); if (Session["CheckedIDs"] != null) checkedIDs = (List<int>)Session["CheckedIDs"]; return checkedIDs; } set { Session["CheckedIDs"] = value; } } Modify check_Clicked and button_clicked : protected void check_clicked(object sender, EventArgs e) { CheckBox me = ((CheckBox)sender); MenuNode m = ((MySpecialEventArgs)(e)).theVar; List<int> checkedIDs = CheckedIDs; if (me.Checked == true) { me.BackColor = System.Drawing.Color.AliceBlue; checkedIDs.Add(m.ID, m.ID); } else

Categories : C#

Powershell log deleted files
First you will need a log-message type function in your script that will log the message to a .log file. Then chekc if the file exists and if not then create a file. Then just before you delete your file with Remove-Item command you can use Log-Message function to log message to the log file. % { (Log-Message "Deleting File $_"); $_ } Complete script $path = "C: est1" $keep = 3 $strLogFileName = "c: estyourlogfile.log"; function Log-Message { Param ([string]$logtext) Add-content $strLogFileName -value $logtext } $dirs = Get-ChildItem -Path $path -Recurse | Where-Object {$_.PsIsContainer} foreach ($dir in $dirs) { $files = Get-ChildItem -Path $dir.FullName | Where-Object {-not $_.PsIsContainer -and $_.name -like "*.zip"} if ($files.Count -gt $keep) { $files |

Categories : File

Renaming .msg files using Powershell
How's this? Essentially the changes I have mades are: Your renaming loop now throws its output to a hashtable. Stop-Process kills Outlook. Another loop then does the renaming. # Declare the hastable to store the names, then generate the names. $nameHash = @{}; Foreach ($msg in $SourceFiles){ # Do the Outlook thing $olMailItem = $NameSpace.OpenSharedItem($msg) $EmailTo = $olMailItem.To $EmailSubject = $olMailItem.Subject $DateRecieved = $olMailItem.ReceivedTime $newfilename = (cleanName($EmailTo)) + (cleanSubject($EmailSubject)) + $DateRecieved.ToString("yyyyMMdd - hhmmss") + ".msg" # Write-Host "Email Sent To: $EmailTo " # Write-Host "Subject: $EmailSubject " # Write-Host "Date Recieved: $DateRecieve

Categories : Powershell

Concatenate files using PowerShell
I would go this route: Get-Content file1.txt, file2.txt | Set-Content file3.txt Use the -Encoding parameter on Set-Content if you need something other than ASCII which is the default for Set-Content.

Categories : Powershell

What are .ps1 files for in PowerShell modules?
The section of your manifest you place the references to the Ps1 files determines how they are executed. In your case: The ScriptsToProcess will execute the listed PowerShell scripts in the callers environment prior to importing the module. This makes me think of them as prep scripts. This is because files listed here are not meant to contain functions, its meant to be a script. If you want additional functions accessible by your module you have a few options: 1) List them in NestedModules, 2) Include them in your module. 3) try listing them in the functions to export section of the manifest. (I have not tried this method, but its my understanding that it will work the way you want no matter where the function is located.)

Categories : Powershell

Join two files in powershell
Use a hashtable where the key is the ID. $ht = [ordered]@{} foreach ($line in $file1) { $id,$rest = $line -split ',',2 $ht[$id] = $line } foreach ($line in $file2) { $id,$rest = $line -split ',',2 if ($ht.ContainsKey($id)) { $ht[$id] += ",$rest" } else { $ht[$id] = $line } } $ht.Values > newfile.txt

Categories : Arrays

Change of pdf files name in powershell
Ok, the quick solution is like this: Get-ChildItem c:All | Rename-Item -NewName { $_.Name.Replace('101','') } Just posted here because you write that you have never used powershell or command prompt. Anyway, you should try yourself - check the other scripts and you will see some patterns like Get-ChildItem ... repeating over and over. Then look at what that means. The same with Rename-Item. If you have Total Commander next time you can try CTRL+M - it opens multi-rename tool. Very useful, used it a lot of times. Invest your time into learning, it pays off.

Categories : Powershell

Renaming Files with PowerShell
You need to specify the -Recurse parameter on Dir to get it to recurse e.g.: Dir -recurse | Rename-Item -NewName {$_.Name -replace ' ','_'} BTW this may run into a problem because you're renaming the folder (FOLDERB) that contains the document first but the item being piped that corresponds to the file in FOLDERB still has the old name. In this case, you want to rename from the bottom up. One very crude but effective (I think) way to do this is to sort the file items on their path length descending e.g.: Dir -recurse | Sort {$_.FullName.Length} -Desc | Rename-Item {$_.Name -replace ' ','_'}

Categories : Windows

How to get a list of people who have checked into a place in Facebook
For privacy reasons, this is not possible at all. Also, FQL is deprecated. I have answered a similar question here: facebook graph API - get last checked users to place/page

Categories : Facebook

Loop a list of checkboxes that some probabbly are not checked in PHP
There is a trick so you always receive a value for a checkbox: <input type="hidden" name="arrayLunes[1]" value="0"> <input type="checkbox" name="arrayLunes[1]" value="1"> <input type="hidden" name="arrayLunes[2]" value="0"> <input type="checkbox" name="arrayLunes[2]" value="1"> So if the checkbox is checked you receive 1 as value and if not you will get the 0. EDIT: Like Daniel said you have more than one arrayLunes. So you have to add an index manually to the array notation. See above. To iterate through your checkboxes do this: foreach($_POST['arrayLunes'] as $val) echo $val ? "YES" : "NO";

Categories : PHP

Visual C++: checked list box doesn't clear
Selected items are not the same thing as checked items. Selected means you have a (usually blue) highlight on the item and checked means the checkbox is ticked. To clear all the checkmarks, you have to use the SetItemChecked method rather than ClearSelected which is actually inherited from ListBox and has nothing to do with check boxes: for (int i = 0; i < checkedListBox1->Items->Count; ++i) { checkedListBox1->SetItemChecked(i, false); }

Categories : Visual C++

Get a list of checked checbox values with jQuery
Loop trough the checked checkboxes, add them to an array and convert it to a string: var checked = []; $('input[type="checkbox"]:checked').each(function() { checked.push($(this).val()); }); var checkedStr = JSON.stringify(checked); Or serialize them like this: $('input[type="checkbox"]:checked').serialize();

Categories : Javascript

how to compare two csv files in powershell without specifying properties
You can obtain the list of CSV column properties via Get-Member -MemberType NoteProperty, then pass that list to Compare-Object. # get list of CSV properties $props1 = $file1 | gm -MemberType NoteProperty | select -expand Name | sort | % {"$_"} $props2 = $file2 | gm -MemberType NoteProperty | select -expand Name | sort | % {"$_"} # first check that properties match (can omit this step if you know for sure they will be) if(Compare-Object $props1 $props2) { throw "Properties are not the same! [$props1] [$props2]" } # pass properties list to Compare-Object else { Compare-Object $file1 $file2 -Property $props1 }

Categories : File

Powershell module and invoking files
. is the current working directory, not the directory in which the module resides. The latter can be determined via the MyInvocation variable. Change your function to this: function MyFunction { $Invocation = (Get-Variable MyInvocation -Scope 1).Value $dir = Split-Path $Invocation.MyCommand.Path $cmd = Join-Path $dir "myBatch.bat" & $cmd $param1 $param2 }

Categories : Shell

PowerShell foreach all files and calculate each md5 value
Parentheses are never used when calling a function or cmdlet in PowerShell. You also have a typo in your foreach-object (note the v in your code). What is calMd5 expecting as a parameter? A file name? Full path to the file? An object? Same questions for what you're putting into $HashQueue. Assuming calMd5 can take the path to the file and that's what you're putting into $HashQueue: $Allfiles = get-childItem -filter *html Foreach-object($Mfile in $Allfiles) { $Md5 = calMd5 $Mfile.FullName If(!$HashQueue.contains($Mfile.FullName)) { Enqueue() } }

Categories : Powershell



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.