Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all 6937 articles
Browse latest View live

Write a command file using out-put has a weird first character

$
0
0

When I use the following statement:

write "rem Beginning " | Out-File -filepath c:\data\RecreateLogs.cmd -Force

The first character is not recognized and I get this error when I run the cmd file.

D:\Data>RecreateLogs.cmd

D:\Data>■p
'■p' is not recognized as an internal or external command,
operable program or batch file.

I've tried different -Encoding with no luck. Any ideas?


Outlook GAL search for Name and return Alias and/or email

$
0
0

Is it possible to search Outlook's (2007) Global Address List for a Name and return the Alias or Email address associated with that Contact using powershell 2.0? 

ugg官網 afhu rpq rxtqp

$
0
0

先生們,我找 Nike來開會,是有一件非常重要的事情要和 jordan 商量。鄉公所裡,郭波面帶微笑、語氣友善的對眼前那些來開會的地主們講著話,一副有事好商量的樣子,不過,在他的心裡面,已經把這些裝扮老土的土鱉們笑了個夠。和沿海一帶的豪紳們比起來,這幫川東的土財主是差遠啦。有啥子好商量的,想到這點來招人,門都沒得。一個四十來歲的中年大叔很不識相的喊了起來。

看他這個樣子,要讓他來當家, Nike Air Maxugg官網那家人早就完蛋了。或者這傢伙是 jordan 家裡派來敷衍我的?郭波有些鬱悶的想著,決定一定要給那家人一點顏色瞧瞧。聽馬局長這麼一說,郭波倒是明白了。劉二麻子,根據他收集到的情報,這個臉上連半點麻子都沒有的傢伙以前做過土匪,後來因為做了一筆大的,才買了地當起了地主——不過,現在看起來,雖然這傢伙當了這麼多年的地主,以前的匪氣還是沒改掉。

馬局長,不要激動, jordan是來交涉的,不是來殺人的。郭波面帶微笑的打斷了交通局長,接著對那個白痴說到:這位先生,不要這麼衝動嘛, jordan 連談都沒談,你怎麼知道連門都沒有呢?商量嘛,大家把各自的條件拿出來,看看能不能談得攏,談得攏,大家都高興;談不攏,到時候再說嘛。何必把話說得這麼絕呢?那你娃有屁就快點放出來,老子還有事。

www.uggbootsaustralia.com.tw ugg boots台灣專櫃 ner952

Nike Air Max qvvh vyc sxykv

GUCCI lbno zye ldhkm

Puma aixn tlw wopex

$
0
0

胡幽藍補充了兩點,最後說到:當然,長官,我認為 匡威最大的優勢在於,當天空艦隊的飛艇出現在 Timberland 頭頂時,馬家軍那些缺乏見識的官兵將會因為驚駭而忘記 Timberland 的使命。這並不是一個完全的描述——當數十艘龐然大物遮蔽天空。馬家軍的官兵很可能會直接崩潰。所以,我認為不會有太激烈地戰鬥。世界上沒有什麼事情是絕對的,幽藍。

儘管話是這麼在說,但郭波事實上已經認可她的看法。不過 天伯倫還有時間與 Timberland 的參謀制定一份完善的計劃——在進入3月前, Timberland Puma不會下達最後地進攻命令。有個小小的提議。郭波保持著微笑。毫無疑問,這將是一個充滿他個人的惡趣味的提議。將計劃制定得華麗一些——盡可能的華麗,就像一部好萊塢電影。這個提議將會得到一絲不苟的執行——天空艦隊的初次戰鬥,絕對會非常華麗。

計劃會像 Timberland想像中的那樣華麗,長官。郭波非常滿意。 Timberland 期待看到 Timberland 的表現。郭波沒有和胡幽藍進一步談論閃擊西北的計劃。史雪兒很快就會出現——他還記得自己邀請她共進午餐——雖然辦公室地隔音效果很好,除非她沒有敲門就闖進辦公室,否則她什麼也不可能聽見;並且郭波也不擔心她有機會將這個秘密傳遞出重慶……但多一事總不如少一事。

lv包包 itev htx ihkvm

new balance ffnh pph oejnd

GUCCI wpiq puk lavnv

Incredimail recovery

$
0
0


IncrediMail recovery tool first scans the corrupt file, then extracts data items from it and finally saves the recovered messages. The highlighting feature of this utility is that it not only restores the accidently deleted emails but also those data items that have been emptied from 'Deleted Items' folder in IncrediMail. Also, this software is widely used for evidence recovery by the computer forensic experts in order to locate deleted mails. Furthermore, this software recovers all mailbox data items such as emails, email properties, attachments, images, etc. with ease and accuracy.Software scans the damaged .imm, .imh, or .imb file to repair it and recover the lost data. After the scanning process gets completed, the software lists the recovered emails. While recovering the lost data, the software maintains emails properties, links, attachments, formats, etc. as is so that you can use the recovered emails without making any changes. To help you verify the quality of recovered data before saving on your computer or network drive, the recovery software enables you to preview the selected email item.

Try the free Evaluation version of the software, if you see the preview of your lost file then go for the option of purchasing the full version so as to save that file at your desired location.

Download Free Trail:- http://www.filesrecoverytool.com/incredimail-recovery.html

execute a powershell script with a specific domain user and password from .bat script automatically

$
0
0

Hi,

I've to execute a .ps1 script from .bat script.

and i've to execute automatically and via a scheduler the .ps1 script with a specific domain user and password.

 

thank you for your help.

have a nice day.

 

 

Can't deploy .dacpac by following technet documentation

$
0
0

Hi, 

I'm trying to follow the msdn documentation to deploy a dacpac on SQL Server 2012 which is installed on my local machine. Here's the link to the documentation: http://technet.microsoft.com/en-us/library/ee210569(v=sql.110).aspx

The script I try to execute is:

 

param (

[string]$dacpacPath = $(throw "-dacpacPath is required."),

[string]$dacName = $(throw "-dacName is required."),

[string]$serverName = $(throw "-servereName is required.")

)

 

$ErrorActionPreference = "Stop"

 

Push-Location

Import-Module sqlps -DisableNameChecking

Pop-Location

 

$srv = Get-Item "SQLSERVER:\SQL\$serverName"

 

## Open a Common.ServerConnection to the same instance.

$serverconnection = New-Object Microsoft.SqlServer.Management.Common.ServerConnection($srv.ConnectionContext.SqlConnectionObject)

$serverconnection.Connect()

$dacstore = New-Object Microsoft.SqlServer.Management.Dac.DacStore($serverconnection)

 

## Subscribe to the DAC events.

$dacstore.add_DacActionStarted({Write-Host `n`nStarting at $(get-date) :: $_.Description})

$dacstore.add_DacActionFinished({Write-Host Completed at $(get-date) :: $_.Description})

 

## Delete previous DAC if exists and drop the database

$dacstore.Uninstall($dacName, [Microsoft.SqlServer.Management.Dac.DacUninstallMode]::DropDatabase)

 

## Load the DAC package file.

$fileStream = [System.IO.File]::Open($dacpacPath,[System.IO.FileMode]::OpenOrCreate)

$dacType = [Microsoft.SqlServer.Management.Dac.DacType]::Load($fileStream)

 

## Deploy the DAC and create the database.

$evaluateTSPolicy = $true

$deployProperties = New-Object Microsoft.SqlServer.Management.Dac.DatabaseDeploymentProperties($serverconnection, $dacName)

$dacstore.Install($dacType, $deployProperties, $evaluateTSPolicy)

$fileStream.Close()

 

## END SCRIPT

 

When I try to run the script from powershell console I get the following exception:

New-Object : Cannot find type [Microsoft.SqlServer.Management.Dac.DacStore]: verify that the assembly containing this type is loaded.

At C:\src\commerce\private\CommerceSearch\relevance\MTurkJudgmentSystem\Publish\deploy-db.ps1:19 char:13

+ $dacstore = New-Object Microsoft.SqlServer.Management.Dac.DacStore($serverconnec ...

+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException

    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

As the documentation states, calling Import-Module sqlps -DisableNameChecking should load all the assemblies automatically, but for some reason this doesn't happen.

I've tried installing packages from here http://www.microsoft.com/en-us/download/details.aspx?id=39976 but it didn't help.

What am I missing from reading the docs?

Thanks.

 

 

 

Creating a XenDesktop Delivery Group with PowerShell

$
0
0

In this article I’m going to create a Delivery Group which provides access to the virtual machines that a part of that catalog.

Read More


Creating an MCS-based XenDesktop Machine Catalog with PowerShell

Store result & use again

$
0
0

Hi,

New to PowerShell, i hope you can help.

A script i am writing is going to delete files within folders at different locations on different servers. I am counting how many files are there are at the beginning so my log im creating has the information. 

$filesInLocation = Get-ChildItem $fileLocation -Recurse | Where-Object { !$_.PSIsContainer } | Measure-Object
$filesInLocation.count

So, imagine this tells me i have X amount of documents within the folders, is there a way to save that result? Because, what i would like to do is once the script completes, and the files are deleted, id like to be told again X amount of documents have been deleted.

Hope this makes sense, please, can anybody help?

KW

ugg boots sale dvisyx hob sovr

$
0
0

~ After their appreciation of this may no longer be that weighed several *** ! This time it was Adidas Cases let suffer a little bit of ! ~ Hey hey hey...... I kept thinking, most inside bursts Yin Xiao, opposite Hal laugh Brosnan have scared some heart, heart is not really going to reconsider its promotion, the other may not be a psychopath if people ah. Of course, now is the Grammy party, the ceremony may not have much time to consider the appointment of the president of a subsidiary, in others he kept urging, and Pete Hal Brosnan took the podium together with Jack.

Overall, however, the company got its own profit is also very impressive, compared to the average king and queen signing lucrative profits to be given effect, let alone profits fame brought by Universal Jack disguised as a. Believe their own company in the future ugg boots sale as long as the good functioning of its albums, not necessarily make him a one billion 800 million ! This is the idea at the moment Pete Hal Brosnan in mind, everything to maximize profits, or to make him not to return for the next Jack investments it! Pete Hal Brosnan ebullient face with Jack shaking hands, hugging, he smiles on Jack said : magic, Custom iphone cases I did not expect "thriller" grades to be so good that at tonight's Grammy party on even invincible, has won numerous awards, but also let iphone cases sale record company Universal Entertainment earned enough honor, iphone cases sale but now I know the original contract signed with you is not necessarily all bad.

But Jack embarrassed, after all, is to make the content of the contract, said their take sixty percent of the royalties, which for a singer is simply incredible, if not the original Gu Nite still look down upon the entire global company own words, and certainly can not get such a generous contract. But then Jack while adjusting the attitude iphone cases sale touched his nose and said : I believe the "angel", there will appear after the album must also achieve good results, this please iphone cases sale assured. http://7coqheron.com/case-custom-photo-cases-4.htm

:

http://danatelford.com/node/14

http://tnuva.panet.co.il/node/90538/webform/components

http://crispi.revinter.com.br/node/70588

question about New-WebServiceProxy in powershell 3.x

$
0
0

Good Day!

Can someone please help me find an answer on 'How to get the response from the Remedy ARS webservice in powershell 3.x' ?

One of the ways I've tried is to have the webservice object created with the below step and I see the below errror.

New-WebServiceProxy : The HTML document does not contain Web service discovery information.

At line:2 char:9

+ $myitsm=New-WebServiceProxy -Uri $uri -Namespace ITSM

............

............

What is happenning is that the Remedy ARS system is feeding/responding with a Logon Page and the new-webservice cmdlet doesn't find any WSDL in there. So fails to proceed.

Here is how I tried.

 $ARSuri=’https://coreweb.itsm.env.srv.yourcompany.com.au/arsys/WSDL/protected/coreapp.itsm.env.srv.yourcompany.com.au/HPD_IncidentInterface_WS'

 

$myitsm

 

 

=New-WebServiceProxy -Uri$ARSuri-Namespace

ITSM

 

 

What's the best way ? 

Let me know if I need to provide any further info.

Thanks in advance.

Using objects correctly to compare various Registry Keys on different Servers

$
0
0

I would like to compare two Servers registry keys to make sure they both match.

 

Something simple like this was the initial plan:

 

    $remote1 = (invoke-command -computername hostname `

    {Get-ItemProperty     "HKLM:SOFTWARE\VENDOR\APP\SUBFOLDER"})

    $local1 = (invoke-command `

    {Get-ItemProperty  "HKLM:SOFTWARE\VENDOR\APP\SUBFOLDER"})

 

    $compare1 = Compare-Object $local1 $remote1

 

That works great for one single specified key but I have multiple keys with sub folders. I can't provide a list of the ones I want to check (and loop round) as I want to make sure nothing new has been added. So I was drawn down this route to get all the keys under a specified branch in the Registry (to get me a list):

 

    $local1 = Get-ChildItem HKLM:SOFTWARE\MICROSOFT\DirectShow -Recurse `

    -ErrorAction SilentlyContinue

 

So I now have an object that will tell me all the registry SUBFOLDERS on the server and I could then loop round using $local1.PSPath to give me all the paths but I noticed something in the object that was interesting:

 

    $local1 | select -first 1 -prop *

 

This returns:

 

    Property      : {dbl3, dbl4, dbl5, dbl6...}

    PSPath        : A path 

    PSParentPath  : A Parent Path 

    PSChildName   : 0

    PSDrive       : HKLM

    PSProvider    : Microsoft.PowerShell.Core\Registry

    PSIsContainer : True

    SubKeyCount   : 0

    View          : Default

    Handle        : Microsoft.Win32.SafeHandles.SafeRegistryHandle

    ValueCount    : 8

    Name          : A Name

 

 

So the Object member "Property" contains what looks like an array of all the keys or is it a sub Object?

 

 

If it was a sub-object does it contain the keys values that I am looking to compare?

 

I could just snatch out the $local.Name member and loop round comparing using the code above and storing any differences but I just wondered if it would be more efficient to use the data that I already have if it contains the information I need?  

 

I am hoping that someone could confirm that if I did:

 

     $local1 = Get-ChildItem HKLM:SOFTWARE\MICROSOFT\DirectShow -Recurse `

    -ErrorAction SilentlyContinue

 

     $remote1 (invoke-command -computername remoteserver1 `

     {Get-ChildItem HKLM:SOFTWARE\MICROSOFT\DirectShow -Recurse `

     -ErrorAction SilentlyContinue})

 

When I do the compare am I actually comparing the keys and values match or just that keys exist? :

 

    Compare-Object $local1 $remote1

 

To cut a long story short, I think I have all the data I need to compare that the Registry key values match (by running this):

 

    $local1

 

Returns (extract):

 

    Hive: HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\DirectShow

 

 

    Name                           Property                                                                                                                                                       

    ----                           --------                                                                                                                                                       

    Debug                                                                                                                                                                                         

    DoNotUse                                                                                                                                                                                      

    DoNotUseDrivers32                                                                                                                                                                             

    Preferred                      {00001602-0000-0010-8000-00aa00389b71} : {E1F1A0B8-BEEE-490D-BA7C-066C40B5E2B9}                                                                                

                                   {e06d8032-db46-11cf-b4d1-00805f6cbbea} : {E1F1A0B8-BEEE-490D-BA7C-066C40B5E2B9}                                                                                

                                   {00000160-0000-0010-8000-00aa00389b71} : {2eeb4adf-4578-4d10-bca7-bb955f56320a}                                                                                

                                   {41564D57-0000-0010-8000-00AA00389B71} : {82d353df-90bd-4382-8bc2-3f6192b76e34}                                                                                

                                   {e06d8026-db46-11cf-b4d1-00805f6cbbea} : {212690FB-83E5-4526-8FD7-74478B7939CD} 

 

Am I correct and does anyone know how to access individual items from the $local1 object? Taking the example above, what is a Hive? Say I wanted the "00001602-0000-0010-8000-00aa00389b71" value how would I get it from the $local1 object.

 

A point to note that the servers are running Powershell 2 while I am testing on Powershell 4 (I can't test on a Production server). I mention this as running $local1 on the v2 servers I get a different output in that the properties do not seem to be in pairs.

 

    Hive: HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\DirectShow

 

 

    SKC  VC Name                           Property

    ---  -- ----                           --------

    0   0 Debug                          {}

    0   0 DoNotUse                       {}

    0   0 DoNotUseDrivers32              {}

    0  10 Preferred                      {{00000050-0000-0010-8000-00AA00389B71}, {e436eb80-524f-11ce-9f53-0020af0ba77...

 

Is this case where the v4 objects will do what I want but the v2 won't? 

ray ban ublf mszo cavn

$
0
0

錦卿立刻拉著錦知回來了,指著最大最寬敞的幾間說道:那多謝姐姐了, new balance 998要這間,這間,還有這間……錦卿手指著看中的房間,最後說道:先就這三間吧,不夠 紐巴倫慢跑鞋 再找姐姐說。袁錦繡當場就跳腳了,指著錦卿罵道:你別得寸進尺! 紐巴倫慢跑鞋 告訴你…………。還沒等她說完,錦卿又一臉失意的拉著錦知往外走,邊走邊對錦知說道:咱們還是去住太醫院吧,跪在喬家仁潤堂門口,求他賞給咱們一間房子住好了。

袁錦繡雙眼噴火的吼道,她相信顧錦卿這個無恥的混賬是說得出做得到,真要是讓顧錦卿跪在了仁潤堂門口,滿京城都知道袁家容不下這對姐弟了。錦卿帶著錦知懶洋洋的轉身,她有點煩了這樣的做戲了,直截了當的問道:那 new balance 996住哪裡?袁錦繡氣紅了臉,深呼吸了幾下才壓下心頭的怒火,指著錦卿剛挑中的房間說道: 紐巴倫慢跑鞋 愛住哪間就住哪間。

錦卿笑了起來,拉著錦知走上前去,笑道:既然姐姐這麼心疼我和錦知, ray ban紐巴倫慢跑鞋只好敬謝不敏了……經過袁錦繡時錦卿彷彿是想起來什麼似的說道:等會我把 紐巴倫慢跑鞋 需要的日用品列出來,還勞煩姐姐幫忙準備齊全了。袁錦繡氣的直跳腳,她又不是顧錦卿的丫景,顧錦卿憑什麼跟指揮丫鬟似的使喚她?錦卿拉著錦知,看也不看袁錦繡就進屋了,袁錦繡在院子裡叫過了幾個丫鬟,吩咐她們把錦卿看中的房間裡值錢的擺設全都搬到她房裡去。

http://www.php-mysql-tutorial.com/forums/t/4774.aspx

https://www.cyberpowerpc.com/forum/forum_posts.asp?TID=41232&PID=204664#204664

http://www.islamicity.com/forum/forum_posts.asp?TID=0&PID=0#0

find user added for deleted from a group in the last three hours

$
0
0

I have a project that I need to find anyone that has been added to or removed from an AD selected groups that begins in APP_RMS in the last three hours.   I need to product a file the has this information        group| sAMAccountName|<ADDED/DELETED>|date and time

I know very little about AD and just a little more about powershell.  I know this should be written in powershell.


Get-ADDomainController use the wrong CD

$
0
0

Hello!

Sorry for my bad english :)

i've asked in an other community but they can't helped me.

We have several domaincontroller in different subnets.

I wanted to interrogate data with ad-cmdlets.

My query is:

 

Get-ADComputer -LDAPFilter  "(name=Computer)" -SearchBase "OU=Germany,OU=x,DC=x,DC=local"

 

Computer belongs to DC0 but it connects automatically with DC1 in an other subnet

When i add "-server" and the right DC then i receive also the same information but from the right DC.

 

Why connects it automatically with the wrong domaincontroller in an other subnet?

 

I hope it is to be understood and someone can help me.

best regards from germany

Create folder and copying files from one server to another server

$
0
0

I wish to know how to create folder in remote server from another server. After creating folders I need to copy my files from some machines which are in other network.

Thanking you,

Satya.

$OSF not working

$
0
0

Hello I have tried the following on PowerShell v4 and v2 but it is not working for me

$Array = @(1,2,3)

$OSF = ", "

write-host $Array

I get

1
2
3

Instead of

1, 2, 3

 

Any ideas please

Thanks

AAnotherUser__

Writing a whois for multipel ips

$
0
0

 

Hi I have started to write some small thingy to run whois with some proxy parameters.

Try to use the webservicex.net and the whois function.

param([String]$domain)
if ($domain -eq "") { $domain = Read-Host "Please Enter Domain" }
if ($domain -eq "") { Write-Host "No domain was entered, quitting.." }
else {
 
$wc = New-Object System.Net.WebClient
$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$wc = New-WebServiceProxy 'http://www.webservicex.net/whois.asmx?WSDL'
$wc.GetWhoIs($domain)
}

and that work, but when i got to do this on mutlipel ips from a source file with ip.

$servers = Get-Content C:\Scripts\hostlist.txt
 
foreach ($_ in $servers) {
 
$wc = New-Object System.Net.WebClient
$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$wc = New-WebServiceProxy 'http://www.webservicex.net/whois.asmx?WSDL'
$wc.GetWhoIs($_) | Out-File -FilePath C:\Scripts\output.txt -Append -Force
}

it does not work, any ideas of the script or just a other great function to use.

 

 

This shouldn't be that hard but it is!

$
0
0

I need to excecute this command (which works perfectly in command prompt)

c:\filesize\testing\dcmdump.exe -v -M +P "0002,0016" -s -q C:\FileSize\testing\1.dcm

 

The closest I have gotten is this:

 

cls

$dcmdump="c:\filesize\testing\dcmdump.exe"

$switch="-v -M +P `"0002`,0016`" -s -q"

$file="C:\FileSize\testing\1.dcm"

$comd="$dcmdump$switch$file"

Write-Output$comd    ##for a scanity check###

&$comd

 

My write-output sanity check line returns fine, however the execution appears to barf – I’m certain that it’s the double quotes in the $switch that’s doing it

c:\filesize\testing\dcmdump.exe -v -M +P "0002,0016" -s -q C:\FileSize\testing\1.dcm

& : The term 'c:\filesize\testing\dcmdump.exe -v -M +P "0002,0016" -s -q C:\FileSize\testing\1.dcm' is not recognized as the name of a

cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is

correct and try again.

At line:7 char:3

+ & $comd

+   ~~~~~

    + CategoryInfo          : ObjectNotFound: (c:\filesize\tes...e\testing\1.dcm:String) [], CommandNotFoundException

    + FullyQualifiedErrorId :CommandNotFoundException

 

Am I missing something here or is this unusually difficult?

I'm on Powershell v4

Viewing all 6937 articles
Browse latest View live