Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all 15028 articles
Browse latest View live

Verbose Logging from within Invoke-Command

$
0
0

Hello,

I cannot figure out how to get this done. I want to Start-Transcript and then log all the verbose information being done inside an Invoke-Command.

Here is my script. I have tried putting the logging inside the scriptblock using the $using variable anything I try fails.

# Resets Counters
$filesLocked = 0
$filesDeleted = 0
$foldersDeleted = 0

# Sets Logging Parameters
$KeepLogsFor = 15
$VerbosePreference = "Continue"
$LogPath = Split-Path $MyInvocation.MyCommand.Path
Get-ChildItem "$LogPath\*.log" | Where LastWriteTime -LT (Get-Date).AddDays(-$KeepLogsFor) | Remove-Item -Confirm:$false
$LogPathName = Join-Path -Path $LogPath -ChildPath "$($MyInvocation.MyCommand.Name)-$(Get-Date -Format 'MM-dd-yyyy').log"
Start-Transcript $LogPathName -Append

# Connects to Home Drives & Finds Files / Folders in CIP to be Deleted
Invoke-Command -ComputerName <servername> -Scriptblock {
$dirs = Get-Childitem -Path "E:\Home" -Exclude Windows -Directory;
    ForEach ($dir in $dirs) {
    $newDirs = "$dir\Documents\CIP\"
    $testpath = Test-Path $newDirs
        If ($testpath) {
        #Deletes Files Only
            $childItemsFile = Get-ChildItem -Path $newDirs -Include st_* -Exclude STAC,upload -File -Recurse -Force
                ForEach ($childItemFile in $childItemsFile) {
                   Try {
                        [IO.File]::OpenWrite($childItemFile).close()
                        Remove-Item -Path $childItemFile -Force -Verbose -ErrorAction Stop
                        $filesDeleted++                                               }
                    Catch {
                          $filesLocked++
                          }

                }
                #Deletes Folders after making sure they are empty
                Get-ChildItem -Path $newDirs -Include st_* -Exclude STAC,upload -Recurse -Force |
                    ForEach-Object {
                            If($_.PSIsContainer -eq $true) {
                                If ((Get-ChildItem -Path $_.FullName) -eq $null) {
                                Remove-Item -Path $_.FullName -Force -Verbose
                                $foldersDeleted++
                                }
                           }
                    }
        }
    }
Return "Files Locked: $filesLocked Files Deleted: $filesDeleted Folders Deleted: $foldersDeleted"

} -Credential $cred
Stop-Transcript

From what I have read for some reason verbose logging will not transfer thru the invoke-command back to the machine that the script is running on. Any suggestions?

Thanks,

Phil


Unable to enable Remoting with SSL on a Windows 2008 R2 server

$
0
0

When I run this command on a Windows 2008 R2 server, I get an error:

winrm create winrm/config/Listener?Address=*+Transport=HTTPS@Hostname="REDACTED";CertificateThumbprint="REDACTED"}

WSManFault
    Message
        ProviderFault
            WSManFault
                Message = This resource requires the following selectors: Address Transport

Error number:  -2144108453 0x8033805B
The WS-Management service cannot process the request because the request contained invalid selectors for the resource.

I have verified I have a proper certificate, signed by our internal CA, and the thumbprint is correct.  I used this same exact command on a Windows 2012 R2 server using the same certificate template to generate the CERT from our CA and it worked perfectly.  So I don't know if this a problem with that particular server or Windows 2008 R2 in general.

Anyone else encountered this problem?

Thanks

NK

Backup printers to location of .bat using printbrm?

$
0
0

Have a little question on how I can backup printers to the location of the BAT script I am running. Usually from USB but either way I want to code it where it does it from any location. Right now its setup to backup to C:\. I read where %~dp0 will do the trick but no idea where to place it. 

%WINDIR%\System32\Spool\Tools\printbrm -B -O FORCE -F C:\printers.printerExport


Deploy Custom Form

$
0
0

I'm hoping someone can help or point me in the right direction.  We're in the process of migrating our Exchange 2007 mailboxes from on-prem to Office365 online.  We need to change the default IPM.Contact form to a customized form (in the example below I'm trying to change the default to zzzContact).  I know this can be down manually but I haven't found a way to automate this change for our environment.  It doesn't appear it can be done through a canned GPO and with the older versions of Office it was done with a registry change.  With Office365 the setting appears to be tied to my mailbox (online).  I'm not sure if this needs to be done with a powershell script or if it needs to be done on the Exchange side.  I'm hoping that someone can shed some light on how this can be accomplished through a script, GPO or Exchange setting.

AD Query Script using ADSISearcher fails on one PC, but works fine on multiple others.

$
0
0

I have pieced together a script to search for users in AD and print out specific attributes for easy access.

This script works fine on multiple PCs within my office, but not on my primary workstation.

do {
 $prompt = "Enter the username."

        [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
        [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

        $objForm = New-Object System.Windows.Forms.Form
        $objForm.Text = "Username?"
        $objForm.Size = New-Object System.Drawing.Size(300,200)
        $objForm.StartPosition = "CenterScreen"
        $objForm.AutoSize = $True
        $objForm.AutoSizeMode = "GrowAndShrink"
        $objForm.Add_Shown({$objForm.Activate(); $objTextBox.focus()})

        $objForm.KeyPreview = $True
        $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
            {$user=$objTextBox.Text;$objForm.Close()}})
        $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
            {$objForm.Close()}})

        $OKButton = New-Object System.Windows.Forms.Button
        $OKButton.Location = New-Object System.Drawing.Size(75,120)
        $OKButton.Size = New-Object System.Drawing.Size(75,23)
        $OKButton.Text = "OK"
        $OKButton.Add_Click({$user=$objTextBox.Text;$objForm.Close()})
        $objForm.Controls.Add($OKButton)

        $CancelButton = New-Object System.Windows.Forms.Button
        $CancelButton.Location = New-Object System.Drawing.Size(150,120)
        $CancelButton.Size = New-Object System.Drawing.Size(75,23)
        $CancelButton.Text = "Cancel"
        $CancelButton.Add_Click({$objForm.Close()})
        $objForm.Controls.Add($CancelButton)

        $objLabel = New-Object System.Windows.Forms.Label
        $objLabel.Location = New-Object System.Drawing.Size(10,20)
        $objLabel.Size = New-Object System.Drawing.Size(280,20)
        $objLabel.Text = $prompt
        $objForm.Controls.Add($objLabel)

        $objTextBox = New-Object System.Windows.Forms.TextBox
        $objTextBox.Location = New-Object System.Drawing.Size(10,40)
        $objTextBox.Size = New-Object System.Drawing.Size(260,20)
        $objForm.Controls.Add($objTextBox)

        $objForm.Topmost = $True

        $objForm.Add_Shown({$objForm.Activate()})
        [void] $objForm.ShowDialog()


## Queries AD based on the username to pull selected information.

$Searcher = [ADSISearcher]"(sAMAccountName=$user)"
$Results = $Searcher.FindOne()
If ($Results -eq $Null) {"User does not exist in AD"}
Else {"User found in AD"}

$userfullname = dsquery user -samid $user | dsget user -fn -ln | select-string fn -notmatch | select-string ln -notmatch |select-string dsget -notmatch
$usertitle = dsquery user -samid $user | dsget user -title | select-string title -notmatch | select-string dsget -notmatch
$userdept = dsquery user -samid $user | dsget user -dept | select-string dept -notmatch | select-string dsget -notmatch
$usermgr = dsquery user -samid $user | dsget user -mgr -l | dsget user -samid | select-string samid -notmatch | select-string dsget -notmatch
$useroffice = dsquery user -samid $user | dsget user -office | select-string office -notmatch | select-string dsget -notmatch

$ErrorActionPreference = "SilentlyContinue"

Get-Variable true | Out-Default; Clear-Host;

$Searcher = [ADSISearcher]"(sAMAccountName=$user)"
$Results = $Searcher.FindOne()
If ($Results -eq $Null) {"User does not exist in AD"}
Else {"User found in AD"

## Prints the selected information to the user.

Write-Host *******************************
Write-Host Username: $user
Write-Host Full Name: $userfullname
Write-Host Title: $usertitle
Write-Host Dept: $userdept
Write-Host Office: $useroffice
Write-Host Manager: $usermgr
Write-Host ********************************

}


$response="y"
$response = Read-Host "Do you want to do another? (Y|N)"
}
until ($response -ne "y")

Exit


I think I must have changed something by accident that may ahve caused this, but I'm not sure what.

I ran the following command 

[adsiSearcher] | fl

from the non-working system and a working system:

non-working -

PS U:\> [adsiSearcher] | fl


Module                     : System.DirectoryServices.dll
Assembly                   : System.DirectoryServices, Version=4.0.0.0, Culture=neutral,
                             PublicKeyToken=b03f5f7f11d50a3a
TypeHandle                 : System.RuntimeTypeHandle
DeclaringMethod            :
BaseType                   : System.ComponentModel.Component
UnderlyingSystemType       : System.DirectoryServices.DirectorySearcher
FullName                   : System.DirectoryServices.DirectorySearcher
AssemblyQualifiedName      : System.DirectoryServices.DirectorySearcher, System.DirectoryServices, Version=4.0.0.0,
                             Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Namespace                  : System.DirectoryServices
GUID                       : 97d301f3-29d5-363e-b7e8-77fc7a4903c5
IsEnum                     : False
GenericParameterAttributes :
IsSecurityCritical         : False
IsSecuritySafeCritical     : False
IsSecurityTransparent      : True
IsGenericTypeDefinition    : False
IsGenericParameter         : False
GenericParameterPosition   :
IsGenericType              : False
IsConstructedGenericType   : False
ContainsGenericParameters  : False
StructLayoutAttribute      : System.Runtime.InteropServices.StructLayoutAttribute
Name                       : DirectorySearcher
MemberType                 : TypeInfo
DeclaringType              :
ReflectedType              :
MetadataToken              : 33554453
GenericTypeParameters      : {}
DeclaredConstructors       : {Void .ctor(), Void .ctor(System.DirectoryServices.DirectoryEntry), Void
                             .ctor(System.DirectoryServices.DirectoryEntry, System.String), Void
                             .ctor(System.DirectoryServices.DirectoryEntry, System.String, System.String[])...}
DeclaredEvents             : {}
DeclaredFields             : {searchRoot, filter, propertiesToLoad, disposed...}
DeclaredMembers            : {Void Dispose(Boolean), Boolean get_CacheResults(), Void set_CacheResults(Boolean),
                             System.TimeSpan get_ClientTimeout()...}
DeclaredMethods            : {Void Dispose(Boolean), Boolean get_CacheResults(), Void set_CacheResults(Boolean),
                             System.TimeSpan get_ClientTimeout()...}
DeclaredNestedTypes        : {}
DeclaredProperties         : {Boolean CacheResults, System.TimeSpan ClientTimeout, Boolean PropertyNamesOnly,
                             System.String Filter...}
ImplementedInterfaces      : {System.ComponentModel.IComponent, System.IDisposable}
TypeInitializer            : Void .cctor()
IsNested                   : False
Attributes                 : AutoLayout, AnsiClass, Class, Public, HasSecurity, BeforeFieldInit
IsVisible                  : True
IsNotPublic                : False
IsPublic                   : True
IsNestedPublic             : False
IsNestedPrivate            : False
IsNestedFamily             : False
IsNestedAssembly           : False
IsNestedFamANDAssem        : False
IsNestedFamORAssem         : False
IsAutoLayout               : True
IsLayoutSequential         : False
IsExplicitLayout           : False
IsClass                    : True
IsInterface                : False
IsValueType                : False
IsAbstract                 : False
IsSealed                   : False
IsSpecialName              : False
IsImport                   : False
IsSerializable             : False
IsAnsiClass                : True
IsUnicodeClass             : False
IsAutoClass                : False
IsArray                    : False
IsByRef                    : False
IsPointer                  : False
IsPrimitive                : False
IsCOMObject                : False
HasElementType             : False
IsContextful               : False
IsMarshalByRef             : True
GenericTypeArguments       : {}
CustomAttributes           : {[System.DirectoryServices.DirectoryServicesPermissionAttribute()],
                             [System.DirectoryServices.DSDescriptionAttribute("DirectorySearcherDesc")]}

working - 

PS U:\> [adsisearcher] | fl *


Module                     : System.DirectoryServices.dll
Assembly                   : System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3
                             a
TypeHandle                 : System.RuntimeTypeHandle
DeclaringMethod            :
BaseType                   : System.ComponentModel.Component
UnderlyingSystemType       : System.DirectoryServices.DirectorySearcher
FullName                   : System.DirectoryServices.DirectorySearcher
AssemblyQualifiedName      : System.DirectoryServices.DirectorySearcher, System.DirectoryServices, Version=2.0.0.0, Cul
                             ture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Namespace                  : System.DirectoryServices
GUID                       : 9ea63a6d-7480-31a3-ac60-1b358a0655a7
GenericParameterAttributes :
IsGenericTypeDefinition    : False
IsGenericParameter         : False
GenericParameterPosition   :
IsGenericType              : False
ContainsGenericParameters  : False
StructLayoutAttribute      : System.Runtime.InteropServices.StructLayoutAttribute
Name                       : DirectorySearcher
MemberType                 : TypeInfo
DeclaringType              :
ReflectedType              :
MetadataToken              : 33554466
TypeInitializer            : Void .cctor()
IsNested                   : False
Attributes                 : AutoLayout, AnsiClass, Class, Public, HasSecurity, BeforeFieldInit
IsVisible                  : True
IsNotPublic                : False
IsPublic                   : True
IsNestedPublic             : False
IsNestedPrivate            : False
IsNestedFamily             : False
IsNestedAssembly           : False
IsNestedFamANDAssem        : False
IsNestedFamORAssem         : False
IsAutoLayout               : True
IsLayoutSequential         : False
IsExplicitLayout           : False
IsClass                    : True
IsInterface                : False
IsValueType                : False
IsAbstract                 : False
IsSealed                   : False
IsEnum                     : False
IsSpecialName              : False
IsImport                   : False
IsSerializable             : False
IsAnsiClass                : True
IsUnicodeClass             : False
IsAutoClass                : False
IsArray                    : False
IsByRef                    : False
IsPointer                  : False
IsPrimitive                : False
IsCOMObject                : False
HasElementType             : False
IsContextful               : False
IsMarshalByRef             : True

I see there are a lot of different fields here, but I don't know how to change them to match for testing.

Is this my problem?

Also, any helpful tweaks to that script would be greatly appreciated. 

Thanks,

Michael


Powershell script query

$
0
0

Hi,

When I  pull Handlecount details via script. i am getting output in below format. The command I used is below

$Lsass_Count = get-process -computername $DC lsass | format-list | findstr "Handles"

Lsass Handlecount
Handles : 1461
Handles : 1917

Does anyone know , how to remove Handles from the output,I only need the value ?

Change existing Powershell script to include more returned objects.

$
0
0

I have the following script which returns various items from Active Directory:

$pSearchBase = "ou=MyOU2,OU=MyOU1,dc=MyDomain,dc=com"
$pOutputHeaders = "Name", "GivenName", "Surname", "EmployeeType", "ObjectClass", "UserPrincipalName", "Enabled", "DistinguishedName", "SamAccountName"
Get-ADUser -Properties employeeType -Filter * -SearchBase $pSearchBase | Select-Object $pOutputHeaders | Export-Csv "GetUsersByProperty_Output.csv"

What I'd like to do is return more objects than what are returned by the Get-ADUser commandlet, as an example, I want to return the Manager object properties as well.


The other properties I want to return are:

* Manager
* Description
* Employee Type
* Location
* City
* Office
* Country
* region
* Expiration Date
* Last Logon Date
* password does not expire

Is this possible using my existing code?



Dropdown menu in an IF statement -- Powershell

$
0
0

Hi ScriptingGuy,

I need some help with my Powershell script. I'm working on a powershell script that asks users information via input message boxes and drop down menu's. The input is set to variables and afterwords added to a MS Word template. Everything is working fine except one issue. I want a drop down menu several times to show based upon input given in a previous question. 

For example:

I ask how many computers the user has. That input will be set in variable $Computers. The next input I need is the operating system for these computers. This is a drop down menu with several option to choose from. If the input in $Computers is 4 then the drop down menu needs to show 4 times.

I tried the following code but it doesn't work unfortunately

# Set values to drop down menu
[array]$DropDownArray3 = "Value 1" , "Value 2", "Value 3"

function Return-DropDown {
 $script:Choice = $DropDown.SelectedItem.ToString()
 $Form.Close()
}

for ($i=1; $i -le $Computers; $i++)
{
$ValueChoice += @(
function SelectValue{
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")

    $Form = New-Object System.Windows.Forms.Form

    $Form.width = 400
    $Form.height = 150
    $Form.Text = ”Operating System”

    $DropDown = new-object System.Windows.Forms.ComboBox
    $DropDown.Location = new-object System.Drawing.Size(100,10)
    $DropDown.Size = new-object System.Drawing.Size(250,150)

    ForEach ($Item in $DropDownArray3) {
     [void] $DropDown.Items.Add($Item)
    }

    $Form.Controls.Add($DropDown)

    $DropDownLabel = new-object System.Windows.Forms.Label
    $DropDownLabel.Location = new-object System.Drawing.Size(25,25)
    $DropDownLabel.size = new-object System.Drawing.Size(100,40)
    $DropDownLabel.Text = "Select a Value"
    $Form.Controls.Add($DropDownLabel)

    $Button = new-object System.Windows.Forms.Button
    $Button.Location = new-object System.Drawing.Size(120,70)
    $Button.Size = new-object System.Drawing.Size(100,20)
    $Button.Text = "Ok"
    $Button.Add_Click({Return-DropDown})
    $form.Controls.Add($Button)

    $Form.Add_Shown({$Form.Activate()})
    [void] $Form.ShowDialog()

    $return = $script:choice
    )}
    }

Can anyone help me in the right direction?


Liist all Users in the Local Administrators Group with Status Enable/Disable for List Servers

$
0
0

Does somebody can help me with that? :(

I have to list all users in local admin group for a list of servers ( same domain ), as follows:

- Servername, Username, Domain, Status(Enable/Disable)

I found some scripts but, none of them brought me STATUS.

I need to list Local Users AND Domain Users, both being part of Local Admin Group.

*** I think status will only appears for Local Users.

I have Windows 2003 Servers in this configuration, so, I think I'll need to use VBScript instead of PowerShell! 

Sorry, but about VBScript, I'm totally newbie!

Thanks a lot! 

Send html mail with result of powershell

$
0
0

Hi,


I'd like to send myself a simple report of App-V packages deployed to a server. Therefore I'd like to use an existing functionGet-AppVPackagesDeployed. However, I can't add the result in an (html) mail.

I know my error is in

$body += $AppVpackagesDeployedFormat

but not sure how to set this correctly.

Please advise.
J.


Function Get-AppVPackagesDeployed
{
     $AppVpackagesDeployed = Invoke-Command -ScriptBlock { Get-AppvClientPackage * -all } -ComputerName OurServers
     $AppVpackagesDeployedFormat = $AppVpackagesDeployed | Select-Object -Property PSComputerName,Name,InUse | Sort-Object -Property Name
}

Get-AppVPackagesDeployed

$body += "Get-AppVPackagesDeployed executed by $env:username on $CurrentDate"
$body += $AppVpackagesDeployedFormat
$body = $body | out-string
Send-MailMessage -From NoReply@ourdomain.com -To myaccount -SmtpServer oursmtpserver -BodyAsHtml -Subject "AppVPackages" -Body $Body



Jan Hoedt

Exporting Active Directory Sites and Services information to csv file

$
0
0

I have found this cool powershell script that displays all AD sites, Domain Controllers, and its Subnets.  The only problem I have is since I have multiple DCs and Subnets within an AD Site, it does not displays it well, or in other words, chops the remain information from the powershell windows.  I tried to extend the size of my PowerShell window screen, but that did not work.  If anyone knows how to export this script to csv file, then maybe, I can see the remaining DCs and or Ip Subnets within a Site.  Below is the script I am using:

[cmdletbinding()]           
param()           

$Sites = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites           

foreach ($Site in $Sites) {           

 $obj = New-Object -Type PSObject -Property (           
  @{           
   "SiteName"  = $site.Name;           
   "SubNets" = $site.Subnets;           
   "Servers" = $Site.Servers           
  }           
 )           

 $Obj           
}

Powershell modifying csv output and adding data to rows

$
0
0
Hello, I have the following script
[cmdletbinding()]
param()

$Sites = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites
$obj = @()
foreach ($Site in $Sites) {
foreach($sub in $site.subnets){

  $obj += New-Object -Type PSObject -Property (
   @{"SiteName"  = $site.Name"SubNet"  = $sub.name
   }
   )}

 }
$obj | Export-Csv 'sites1.csv' –NoType
What I need it to do is add a comma after subnet, so therefore i.e: 1.1.1.1/24, in the output CSV, and for site name, I want it to add some text that I define before the sitename but in the same column.  Any ideas?

Adam


Finding PST files from a list of computers

$
0
0

Hello, i'm trying to find PST files on a number of computers that I have. I put the computer names in a text file and i am running the following script against it:

$strComputers = Get-Content -Path "C:\computernames.txt" [bool]$firstOutput = $true foreach($strComputer in $strComputers) { $colFiles = Get-Wmiobject -namespace "root\CIMV2" ` -computername $strComputer ` -Query "Select * from CIM_DataFile ` Where Extension = 'pst'" foreach ($objFile in $colFiles) { if($objFile.FileName -ne $null) { $filepath = $objFile.Drive + $objFile.Path + $objFile.FileName + "." `+ $objFile.Extension; $query = "ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" `+ $filepath `+ "'} WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner" $colOwners = Get-Wmiobject -namespace "root\CIMV2" ` -computername $strComputer ` -Query $query $objOwner = $colOwners[0] $user = $objOwner.ReferencedDomainName + "\" + $objOwner.AccountName $output = $strComputer + "," + $filepath + "," + $user + "," + $objFile.FileSize/1KB + "," + $objFile.LastModified if($firstOutput) { Write-output $output | Out-File -Encoding ascii -filepath "C:\pstdetails.csv" $firstOutput = $false } else { Write-output $output | Out-File -Encoding ascii -filepath "C:\pstdetails.csv" -append } } } }

What this script is doing is reaching out to the computers in the list and using WMI, it is giving me a list containing the computer name, PST file location and the size of the PST file.

My problem is, i need it to also tell me that it did not find a PST file on a specific computer in case that computer did not have a PST file, which right now, the script is not doing.

How can I get it to do that?

Thanks,

Set user AD Primary Group to default

$
0
0
Need your help Guys,

By Default, the AD Primary Group of a user is the "Domain Users" group. In our company, an administrator has changed this default group for another group (DepartmentGroup) on many users. 
Now the MemberOf properties of those users doesn't report this group (DepartmentGroup) with the other groups that they belong to.
By Using powershell, are there an easy way to get back the Primary Group to "Domain Users" for those users ?

Thanks for your help.

List all shared folders networks and export to Excel

$
0
0

Can anyone help me to create a powershell scripts to look at each server listed in the servers.txt, and listing all shared folders in a servers in entire internal network and finally create a report in excel?


Export the List of all Members in "Universal Security" Group with Distinguished Name.

$
0
0

Hi All,

In My root Domain [ 2008 R2] have one "Universal Security" Group created only in rot domain  which is having members of both root & child domains. My client want to generate reports on every months with below details

1. Total Users with Description, Username, Domain Name in that Group.

I have tried "ADGroupMembers" Tool which only list the Total users which couldn't help and some External tools like ADINFO only list the members of Root Domain and child domain users were missing.

Pls help to run some power shell commands or VBscript in order to meet the requirement [Export Total Users with Description, Username, Domain Name of Users in Group.]

Report of unread email

$
0
0
Hello, I'd like to make a report of the number of unread email for all mailboxes. Can I have it from PowerShell ? Thanks.

please help me in powershell forms scripts

$
0
0

I am working on to develop GUI from powershell scripting.

Please help me in providing good link to learn the same.

And currently I am facing issue in opening form 2 from form 1 by closing form 1.

$form1 = new-object system.windows.forms.form

$form2 = new-object system.windows.forms.form

$button = new-object system.windows.forms.button

$button.text = "NEXT"

$button.add_click({ $form2.showdialog()

$form1.close()

})

$form1.controls.add($button)

$form1.showdialog()

By clicking next button I am able to open form  form2 but form1 is not closing.

Get Users Photo from Office 365 (Get-UserPhoto)

$
0
0

Hi all,

I can use Get-UserPhoto cmdlet to find out about a users' photo (via msonline module etc.), but how (if at all) can I use it to actually retrieve the photo itself?

And, if I can't use this cmdlet, how else could I script it for a user to retrieve their own photo from Office 365?

(What I'd like to do is to use that photo as the Windows 8(.1) account picture, which people have written simple scripts for already IF that photo comes from AD. e.g.,http://blog.jourdant.me/ps-setting-windows-8-account-picture-from-ad/)

Many thanks!

Robin

`devcon.exe failed` on `devcon install %windir%\inf\netloop.inf *msloop`

$
0
0

I try to install loopback adapter by script.

First of all, I've tried to right-click netloop.inf > install to no avail.

Now I try to use devcon with admin rights:

>devcon install %windir%\inf\netloop.inf *msloop
devcon failed.

And no loopback appears among adapters.

Could you please prompt me how to install msloop on Windows 10?

In setupapi.dev.log I see only right-click installs:

>>>  [Device Install (DiInstallDriver) - C:\Users\ilyaigpetrov\Desktop\netloop.inf]
>>>  Section start 2015/11/15 10:17:23.909
      cmd: "C:\Windows\System32\InfDefaultInstall.exe" "C:\Users\ilyaigpetrov\Desktop\netloop.inf"
     inf: {SetupCopyOEMInf: C:\Users\ilyaigpetrov\Desktop\netloop.inf} 10:17:23.925
!    inf:      Driver package is already in driver store
     inf:      Driver Store Path: C:\Windows\System32\DriverStore\FileRepository\netloop.inf_amd64_818d00c16de7dfdc\netloop.inf
     inf:      Published Inf Path: C:\Windows\INF\netloop.inf
     inf: {SetupCopyOEMInf exit (0x00000000)} 10:17:24.394
<<<  Section end 2015/11/15 10:17:24.456
<<<  [Exit status: SUCCESS]


>>>  [Device Install (DiInstallDriver) - C:\Windows\INF\netloop.inf]
>>>  Section start 2015/11/15 10:17:45.955
      cmd: "C:\Windows\System32\InfDefaultInstall.exe" "C:\Windows\INF\netloop.inf"
     inf: {SetupCopyOEMInf: C:\Windows\INF\netloop.inf} 10:17:45.955
     inf:      Driver Store Path: C:\Windows\System32\DriverStore\FileRepository\netloop.inf_amd64_818d00c16de7dfdc\netloop.inf
     inf:      Published Inf Path: C:\Windows\INF\netloop.inf
     inf: {SetupCopyOEMInf exit (0x00000000)} 10:17:45.986
<<<  Section end 2015/11/15 10:17:46.033
<<<  [Exit status: SUCCESS]


>>>  [Device Install (DiInstallDriver) - C:\Windows\INF\netloop.inf]
>>>  Section start 2015/11/15 10:25:48.459
      cmd: "C:\Windows\System32\InfDefaultInstall.exe" "C:\Windows\INF\netloop.inf"
     inf: {SetupCopyOEMInf: C:\Windows\INF\netloop.inf} 10:25:48.459
     inf:      Driver Store Path: C:\Windows\System32\DriverStore\FileRepository\netloop.inf_amd64_818d00c16de7dfdc\netloop.inf
     inf:      Published Inf Path: C:\Windows\INF\netloop.inf
     inf: {SetupCopyOEMInf exit (0x00000000)} 10:25:48.475
<<<  Section end 2015/11/15 10:25:48.521
<<<  [Exit status: SUCCESS]

>sq query msloop

[SC] EnumQueryServicesStatus:OpenService FAILED 1060:

The specified service does not exist as an installed service.

>devcon update %windir%\inf\netloop.inf *msloop

Updating drivers for *msloop from C:\Windows\inf\netloop.inf.
devcon failed.

>>>  [Device Install (UpdateDriverForPlugAndPlayDevices) - *msloop]
>>>  Section start 2015/11/15 13:17:21.453
      cmd: devcon  update C:\Windows\inf\netloop.inf *msloop
!    ndv: Unable to find any matching devices.
<<<  Section end 2015/11/15 13:17:21.502
<<<  [Exit status: FAILURE(0xe000020b)]

>devcon hwids =net
USB\VID_12D1&PID_14DC&MI_00\6&12F08311&0&0000
    Name: Remote NDIS based Internet Sharing Device
    Hardware ID's:
        USB\VID_12D1&PID_14DC&REV_0102&MI_00
        USB\VID_12D1&PID_14DC&MI_00
    Compatible ID's:
        USB\MS_COMP_RNDIS
        USB\Class_e0&SubClass_01&Prot_03
        USB\Class_e0&SubClass_01
        USB\Class_e0
SWD\IP_TUNNEL_VBUS\TEREDO_TUNNEL_DEVICE
    Name: Microsoft Teredo Tunneling Adapter
    Hardware ID's:
        *TEREDO
    Compatible ID's:
        SWD\GenericRaw
        SWD\Generic
SWD\IP_TUNNEL_VBUS\ISATAP_1
    Name: Microsoft ISATAP Adapter #2
    Hardware ID's:
        *ISATAP
    Compatible ID's:
        SWD\GenericRaw
        SWD\Generic
ROOT\KDNIC\0000
    Name: Microsoft Kernel Debug Network Adapter
    Hardware ID's:
        root\kdnic
PCI\VEN_168C&DEV_002B&SUBSYS_7167144F&REV_01\4&150BFCAA&0&00E0
    Name: Qualcomm Atheros AR9285 Wireless Network Adapter
    Hardware ID's:
        PCI\VEN_168C&DEV_002B&SUBSYS_7167144F&REV_01
        PCI\VEN_168C&DEV_002B&SUBSYS_7167144F
        PCI\VEN_168C&DEV_002B&CC_028000
        PCI\VEN_168C&DEV_002B&CC_0280
    Compatible ID's:
        PCI\VEN_168C&DEV_002B&REV_01
        PCI\VEN_168C&DEV_002B
        PCI\VEN_168C&CC_028000
        PCI\VEN_168C&CC_0280
        PCI\VEN_168C
        PCI\CC_028000
        PCI\CC_0280
{5D624F94-8850-40C3-A3FA-A4FD2080BAF3}\VWIFIMP_WFD\5&14E55B1&0&01
    Name: Microsoft Wi-Fi Direct Virtual Adapter
    Hardware ID's:
        {5d624f94-8850-40c3-a3fa-a4fd2080baf3}\vwifimp_wfd
    Compatible ID's:
        {5d624f94-8850-40c3-a3fa-a4fd2080baf3}\vwifimp_wfd
PCI\VEN_11AB&DEV_4354&SUBSYS_C06D144D&REV_00\4&95D8421&0&00E3
    Name: Marvell Yukon 88E8040 Family PCI-E Fast Ethernet Controller
    Hardware ID's:
        PCI\VEN_11AB&DEV_4354&SUBSYS_C06D144D&REV_00
        PCI\VEN_11AB&DEV_4354&SUBSYS_C06D144D
        PCI\VEN_11AB&DEV_4354&CC_020000
        PCI\VEN_11AB&DEV_4354&CC_0200
    Compatible ID's:
        PCI\VEN_11AB&DEV_4354&REV_00
        PCI\VEN_11AB&DEV_4354
        PCI\VEN_11AB&CC_020000
        PCI\VEN_11AB&CC_0200
        PCI\VEN_11AB
        PCI\CC_020000
        PCI\CC_0200
7 matching device(s) found.

Thanks in advance.





Viewing all 15028 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>