Cannot convert xml file
Hello guys,At start I’m new in Powershell and I have a little problem with processing xml file. I try open Virtualbox.xml file [xml]$xml = Get-Command c:\VirtualBox.xmland receive that error.Cannot...
View ArticlePowershell sql server install automation
I need help with below code I am writing to automate sql server installparam( #Name of SQL Server host [parameter(Mandatory=$true, HelpMessage="Enter Server Name/machine...
View ArticleHow to add a computer name into object
Can someone advise on how to approach this?i have some code that works fine.$Clients = (Get-QADComputer -SearchRoot "abc.forest.org/myou").name $Range = (get-date) - (new-timespan -hour 48) $errors =...
View Articleexecution error
Hi, With the help of msdn members,i am able to create script to check the status of azure online backups..But i am stuck at this moment. simple get-objob works but when i put in script block it...
View Articlepowershell execution error
Hi,I am getting the below error while executing PS.Anybody experienced the same? what could be the reason?Best Regards, Arun http://whynotsql.blogspot.com/
View ArticleCalling MSBuil with arguments in PowerShellScript
Hi, I am trying to call below line of code from powershell script. But it is giving an error..Installer.target file exists in the same location (C:\Projects\Main\src>). What is the wrong with below...
View ArticleDo until statement not working as intended
I have the following code: $vms = get-vm foreach ($vm in $vms){ $vm.state;$vm.name;Stop-VM -VM $vm -force | out-null } do { start-sleep -seconds 3 Write-Host $vm.name “ is...
View ArticleTrying to remove header from the CSV file output
Is it possible to remove the header information from the output. I have tried a few things like -hidetablerheaders and -expandproperty.Here is the code:get-aduser -filter * -properties name,...
View ArticleUsing Powershell to read XML
I have a weird XML doc where the data is contained in the node in placed.An example. <computers><computerData ip-Dir="127.0.0.1" name ="eth01"/></computers>What I want to do is get...
View ArticleCompare directories
I would like to compare 2 directories which are not equal but should contain the same files in a different folder structure.I use robocopy with a csv file to copy files to another folder...
View ArticleHow to connect windows remote system with Powershell script and find disk...
Hi All,I am testing a powershell script that connects to remote computer and displays me the size of the each drive in the remote system. But when i try to run the below script i am receiving "Access...
View ArticleRemove multiple users from multiple AD groups
I have a list of over 100 users that I need to remove from all groups that they are a part of (other than the primary group). So I'm trying to make a script that will take each user from my list,...
View ArticleWSUS Move Computer script not working
I have a script on our Windows 2003 R2 Server for WSUS to move a computer to a specific managed group. Here is the code:# Connect to WSUS server...
View ArticleSQL bulk copy from csv file - Encoding
Hi ExpertsThis is the first time I am creating a PowerShell script and it is almost working. I just have some problems with the actual bulk import to SQL encoding from the text file since it replaces...
View Articlechanging local user password via ADSI ( not one-line code)
Hi friends i am exercising ADSI WinNT to manage local user accounts on my test win8.1 station. i have a user named "mytestuser" & i want to change his password. if i don't mistake i am wrong in...
View Article"12" -eq 012 Why does it return $True
PS:\"12" -eq 012TrueMay be I am missing something but my understanding is that the data type of left hand operand is forced on the right hand operand. So why should the above return True? My...
View ArticleChange Local Admin Password
Alright, I am beating my brains in over here. I am trying to query AD for a list of computers based on OS Type and change the passwords accordingly. I can query AD and find all of the computers, but...
View ArticleReplacing Single Line of Code in XML File on Multiple Systems
Hey Guys - I'm not a pro PowerShell user, but dabble in it when I can. I have a task I need to perform which I need assistance with, please - one that I'd think would be easy for the pros.I am needing...
View Article“Argument null or empty” errors in Powershell function using Invoke-SQLCmd
Hi Guys,I have the following scrip :sqlps -NoLogo -Command{invoke-sqlcmd -InputFile "D:\MyProject\CreateDatabase.sql"}Which work well, but when when i want to replace the imput file by a variable like...
View ArticleSame script in V3 and V4, working in v4 but not in V3
Can someone help me , i am trying to use send-mailmessage to send mails to multiple users . I am picking the mailids from text file and assigned that to a variable and calling the variable in -to , It...
View Article